Sharepoint Forum

Ask Question   UnAnswered
Home » Forum » Sharepoint       RSS Feeds

Programmatic conversion of docx to web page

  Asked By: Fredrick    Date: Apr 12    Category: Sharepoint    Views: 1813

When is using SPFile.Convert a recommended approach to convert docx files to web pages? I see that PublishingPageCollection.Add has an overload for conversion of docx to a web page. If we are working with Publishing site, is later a preferred way for document conversion?



2 Answers Found

Answer #1    Answered By: Anuj Lakhe     Answered On: Apr 12

OK. document  Converters are the standard way to do what you want, and can be manipulated through the Sharepoint API. That SPFile.Convert method you saw was indeed related to Document Converters. However, it in itself can't be used to do the conversion  programmatically. There are three overloads (from memory!) on the PublishingPageCollection.Add method, and you use one of those to specify your SPFile instance, a GUID that identifies the document converter (find that in the Doc Converter Feature element file), then there's a priority indicator and you can plug in a config XML file too.

That's the document converter way, which would be the standard way. However there are commercial components that do such conversions too. There's nothing to stop you getting one of those, deploying it to the GAC with your feature and calling it's conversion methods from your event. You not bound to only using Document Converters to achieve this.

Now, I realise I've rambled a bit here! Am I making sense!?

Answer #2    Answered By: Lee Dickerson     Answered On: Apr 12

Are you aware of document  Converters? You should be able to convert  your Docx files  to Publishing Pages without any code at all.

See this reference; msdn.microsoft.com/en-us/library/ms544523.aspx

If they aren't suitable, it'd be helpful if you elaborated on your requirements a little.

Didn't find what you were looking for? Find more on Programmatic conversion of docx to web page Or get search suggestion and latest updates.