RE: .doc conversion to .docx moss 2001 to 2007

From: Nick

In an ideal world I would like to convert all of my .doc’s to the new template which is a …docx. Is that a possibility with aspose? What I am running into is these word documents are all of our ISO controlled documents that are currently .doc and my new template integrates with SharePoint to put the revision number on the document. So I have to find a way either with aspose or manually convert all of them and then copy them to the new template. Also is there any demos of the conversion from …doc to .docx?

Thanks
Nick
----------------------------------
From: Aspose.Auckland

Hi Nick,

Aspose.Words is a …NET programming component. Conversion is accomplished easily with two lines of code:

Document doc = new Document(srcFile); 
doc.Save(dstFile, SaveFormat.Docx); 

Is that enough for you or you are looking for a complete solution that does not require programming, specifically for sharepoint?

Regards,
Roman Korchagin

-----------------------------------------
From: Nick

I am currently working on migrating all of our .doc documents from sharepoint 2001 to a new .docx template on MOSS 2007. I am curious if aspose.words can help me on this task. Also I am curious if there is a demo of converting files anywhere on your site.

Thanks

This message was posted using Email2Forum by romank.

  1. Sorry I don’t understand what do you mean by “demo”. The two lines of code I included in my previous email IS the demo how to convert a document from .doc to .docx.
  2. There is no ready demo how to convert all .doc to .docx from sharepoint 2001 to moss 2007.
  3. Sorry, I don’t understand that “convert to the new template” means. .doc and .docx are not templates, they are file formats. If you want to convert .doc to .docx then you are talking about converting to a new format. The word “template” for Word documents means a different thing, it means a document in the .dot or .dotx format that is used as a template for creating new documents.

Yeah i may have explained that a little weird. What i have is about 400 word documents that are currently in a .doc format. I am using docave migration tool to migrate all of them from sharepoint 2001 to MOSS2007 so i don’t lose any version history. On the document libraries i have created a template that utilizes some .net code so automatically update the version number on the document header(we need this for an ISO audit).
So right now i have to open the .doc and copy paste all of the info to the new template and then publish the documents. I know aspose will allow me to convert .doc to .docx. What i would like to do is open a .doc copy all the text minus all the header information, and then copy it all to the new template which has my new header information and then save it. I hope this makes more sense, if not let me know.
Nick

Hi
Thanks for your explanation. Of course you can achieve this using Aspose.Words. For example see the following code and the attached documents.

// Open the old template (DOC)
Document oldTemp = new Document(@"Test265\oldTemp.doc");
// Open new template (DOCX) with new headers
Document newTemp = new Document(@"Test265\newTemp.docx");
// Remove body of new template
newTemp.FirstSection.Body.Remove();
// Import body of old template
Node newBody = newTemp.ImportNode(oldTemp.FirstSection.Body, true, ImportFormatMode.KeepSourceFormatting);
// Insert body into the new template
newTemp.FirstSection.AppendChild(newBody);
// Save template in DOCX format
newTemp.Save(@"Test265\out.docx", SaveFormat.Docx);

Hope this helps.
Best regards.

In general yes, Alexey’s code does that. Buy you might have to add or change few things.
First of all, the code above will copy only one section, it is wrong to assume all documents have only one section, therefore you need a loop for Document.Sections and do that in the loop.
Next, you need to consider what happens with things like document properties, VBA macros and styles. By using this approach copying from existing to a new document you are only copying content and formatting. Document properties and VBA macros will not be copied. Although styles do get copied, they might get new names such as Normal_0 and so on, this is explained in details in the ImportFormatMode documentation.
So instead of copying content from old document to a new document based on a template you should consider copying headers from the template to the existing document and then saving in the .docx format.

That sounds like it will work for us since i don’t want to lose the current document properties. Another question is can aspose.word do mass conversion. We have about 300 documents we need converted.
Thanks
Nick

Hi
Thanks for your inquiry. Yes of course you can convert multiple files. Just loop through all files and convert them.
Best regards.

Hi!
We are delighted to announce the availability of Aspose.Words for SharePoint, which is our latest addition to the Aspose.Words product family.
This release, Aspose.Words for SharePoint 1.0 makes high quality document conversions for DOC/DOCX/ODT/RTF/PDF/XPS and others easily accessible to SharePoint users.
Please find more details in our Documentation area.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(11)