Free Support Forum - aspose.com

Open .dot- save as .doc is still recognized as template

I have the following problem

I create some Document from .dot template (change some fields,…), then save it as .doc and open it in Microsoft Word 2000 (or view it without saving) the file has an icon of a .doc file, but when i choose save as, I can only save the document as template. All other options are disabled (Normal word document, …)

if i print doc.AttachedTemplate it is an ampty string, but if I print it with looping through builtin/custom document properties, the name of my .dot file is printed.

I attached an example document - createt from .dot and saved with aspose.words to .doc file. If I open it I can only save it as template. We even tried with Word 2003, there you are able to save as some other format, but Word suggest saving as word template.


and the .dot template that created my previous .doc document

let me just clear one more time the problem:
The .doc file created from .dot is in all MS Words still recognized as template no mather that it has a .doc extension (someting from .dot remained - some flag or smth…). Word 2002 or newer suggest saving a file in “word template” format but older Word 2000 restricts saving in any other format then “word template”.

Some work arround, that might solve the problem: In C# I open .dot document and try to copy that document to some other new empty document. I managed to copy all the sections, but with heads and footers i had some problems. When I opened this newly created document in word, it was recognized as a normal document(problem fixed). I would like to ask professionals for help. In this case i need a complete copy(of my .dot template) of every thing that exists in the document (all text, tables, sections, headers, footers,… - the visible part). Can you help me with this code?

I attached a picture of the problem in word 2000. The dialog is not english, but you will understand the problem: Save As dialog with default document type “template” and the restriction of choosing any other format than template.

I have reproduced the problem and logged it to our defect base as issue #1223. We will probably be able to fix it in the next release which will be published in the end of August.

Meanwhile, try the following workaround. Just create a new document and copy all the sections from the template to the new document. That seems to eliminate the problem.

Here is the code:

string filename1 = Application.StartupPath + @"\NP\NPSAMPLE.dot";

string filename2 = Application.StartupPath + @"\NP\NPSAMPLE Out.doc";

Document doc1 = new Document(filename1);

Document doc2 = new Document();

foreach (Section section in doc1.Sections)

{

doc2.Sections.Add((Section)doc2.ImportNode(section, true, ImportFormatMode.KeepSourceFormatting));

}

doc2.FirstSection.Remove();

// Save resulting document.

doc2.Save(filename2);

// Open saved document in MS Word.

System.Diagnostics.Process.Start(filename2);

Hope this will help.

Best regards,

THANK YOU!

That was just what I needed!

Please check the latest 4.0 version of Aspose.Words. We have added Document.IsTemplate property there that controls whether the document is template or not. Setting this property to false resolves all the issues.

Best regards,