Thank you for additional information. I can successfully save your document in DOC format and other formats. I used the following code for testing:
// Open document.
Document doc = new Document(@"Test001\Test.rtf");
// Save output document in different formats.
doc.Save(@"Test001\out.doc", SaveFormat.Doc);
doc.Save(@"Test001\out.docx", SaveFormat.Docx);
doc.Save(@"Test001\out.xml", SaveFormat.WordML);
doc.Save(@"Test001\out.rtf", SaveFormat.Rtf);
doc.Save(@"Test001\out.txt", SaveFormat.Text);
doc.Save(@"Test001\out.html", SaveFormat.Html);
However, an exception occurs, when I try to save this document to ODT format and during rendering (converting to PDF/XPS/Image). You will be notified as soon as it is resolved.
As I am getting the RTF files with DOC extension, it’s better if you test the same document with DOC extension, instead of RTF.
To create an object ASPOSE.WORD taking bit higher time (8sec for 1.5mb file), is there any way to reduce the time? because it is hitting the performance issue.
Actually, RTF format is slower than other formats, because it is text format. For example, if you convert your RTF document to binary DOC format, it takes less than 1 second to open and save it.
When I am working on RTF files and try to save or merge files, I am getting the ““Object reference not set to an instance of an object.” Error.
below is the sample code
Document doc = new Document(Path);
doc.Save(Folder + "\\" + SourceFile.Name);
Whenever I try to create a object using
Document doc = new Document (@"c:\Test.doc");
is taking around 8sec(for 1.5MB file size) in development environment is there any way to reduce the time? because it is hitting the performance issue, and it is throwing error when I am try to save the document in a different location by using
Thanks for your request. As I can see this post describes the same as you already described above.
As I told you earlier, I managed to reproduce the problem during saving document to PDF and ODT format and you will be notified as soon as the problems are resolved.
Exception does not occur when I save your document in DOC format. Which exception do you get when save your document to DOC? This code works just fine with your document on my side:
// Open document.
Document doc = new Document(@"Test001\Test.doc");
// Save output document.
doc.Save(@"Test001\out.doc");
On my side it takes 3 seconds to open/save your document, this is normal time for large RTF, if you would like to improve performance, use DOC format instead of RTF.
Thanks for your reply,
I tested the application with 8mb document; it is taking around 19sec to create a object. Here I am attaching the code with time screen shot and document.
Why is it taking such a huge time?
Help me with a way to reduce the time for creating an object.
Thanks for your request. As I wrote you earlier, RTF format is slower than other formats, because it is text format and that is why it takes more time to parse RTF files. You can observe the same behavior, when try opening large RTF documents in MS Word. IF you would like to improve performance, you can try using binary DOC format instead of RTF.
We had an issue with some of the RTF files, and you gave a fix, after this fix, we started getting performance issues. Earlier before the latest release it used to work fine, just want to understand is there some thing in the current ASPOSE version causing this performance issue.
Thank you for additional information. I do not think, that this fix can affect the performance of the document loading. Which version of Aspose.Words did you use before?
Thank you for additional information. I tested with Aspose.Words 6.3.0 nad result is the same. Time to load and save your document is the same using 6.3.0 and 6.6.0 versions of Aspose.Words.
I found this issue will be with my documents. I am here placing my stack trace. As a security issue I cont send you the documents.
If you have information on what type of content in a RTF file Aspose.word will not process, please share with us, it will help us in understanding the our own documents.
i checked the one more thing it is throwing the same error when i use the method
Document doc = new Document(@"c:\Test\Test.doc");
doc.ExpandTableStylesToDirectFormatting();
I noticed one more thing in my RTF files is, if i add or remove a even single space from the file, the size of the document is reduced from 2mb to 300kb. If you have any information on this please share with us, it will help us a lot.
Stack trace:-
Check here, it is trying to create a table, which it can’t understand and throwing error.
at Aspose.Words.Tables.Table.ᯨ()
at ㏌.㏋.VisitTableStart(Table table)
at Aspose.Words.Tables.Table.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.ဢ(DocumentVisitor ྍ)
at Aspose.Words.Body.Accept(DocumentVisitor visitor)
at ㏌.㏋.Ἧ(Section )
at ㏌.㏋.㏢()
at ㏌.㏋.ἧ(Ὑ Ἠ)
at Aspose.Words.Document.(Stream ܭ, String ܬ, SaveFormat )
at Aspose.Words.Document.Save(String fileName, SaveFormat fileFormat)
at FilesHelper.DirectoryHelper.DownloadFile(String FileName, String Folder, Int32 ExecutionType) in C:\GCFHDWordServiceNew\FileHelper\DirectoryHelper.cs:line 150
Please attach sample document and code, which will allow me to reproduce the problem on my side. I will check the issue and provide you more information.
I found this issue will be with my documents. I am here placing my stack trace. As a security issue I cont send you the documents.
If you have information on what type of content in a RTF file Aspose.word will not process, please share with us, it will help us in understanding the our own documents.
i checked the one more thing it is throwing the same error when i use the method
Document doc = new Document(@"c:\Test\Test.doc");
doc.ExpandTableStylesToDirectFormatting();
I noticed one more thing in my RTF files is, if i add or remove a even single space from the file, the size of the document is reduced from 2mb to 300kb. If you have any information on this please share with us, it will help us a lot.
Stack trace:-
Check here, it is trying to create a table, which it can’t understand and throwing error.
at Aspose.Words.Tables.Table.ᯨ()
at ㏌.㏋.VisitTableStart(Table table)
at Aspose.Words.Tables.Table.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.ဢ(DocumentVisitor ྍ)
at Aspose.Words.Body.Accept(DocumentVisitor visitor)
at ㏌.㏋.Ἧ(Section )
at ㏌.㏋.㏢()
at ㏌.㏋.ἧ(Ὑ Ἠ)
at Aspose.Words.Document.(Stream ܭ, String ܬ, SaveFormat )
at Aspose.Words.Document.Save(String fileName, SaveFormat fileFormat)
at FilesHelper.DirectoryHelper.DownloadFile(String FileName, String Folder, Int32 ExecutionType) in C:\GCFHDWordServiceNew\FileHelper\DirectoryHelper.cs:line 150
All content in the RTF documents should be processed.
Each document format allows some fluctuation, some parts of the document are not required, and some parts can be written differently. That is why size of the documents can be different after processing or resaving documents.
Unfortunately, I cannot provide you any information regarding the issue you have reported without your document. I need to reproduce the problem to analyze it. You can try removing sensitive content from your document and attach it here or send it to my e-mail.
We installed the latest ASPOSE.WORD from the update you gave in the post.
Here are the details of Aspose.Words.dll
Assembly Version: 7.0.0.0
Product Version: 2009.09.14
But still we are getting the same error while saving the RTF document. We tested with the same document we attached to this post earlier. But still for your reference I’m attaching another document that is causing this issue.
Exception Message: Object reference not set to an instance of an object.
Exception StackTrace:
at Aspose.Words.Tables.Table.ᛷ()
at ㋟.㋞.VisitTableStart(Table table)
at Aspose.Words.Tables.Table.Accept(DocumentVisitor visitor)
at Aspose.Words.CompositeNode.Ս(DocumentVisitor Վ)
at Aspose.Words.Body.Accept(DocumentVisitor visitor)
at ㋟.㋞.⌱(Section )
at ㋟.㋞.㋵()
at ㋟.㋞.〈(⍝ 〉)
at Aspose.Words.Document.ԅ(Stream Ӿ, String Ӽ, SaveFormat Ԇ)
at Aspose.Words.Document.Save(String fileName, SaveFormat fileFormat)
at Aspose.Words.Document.Save(String fileName)
at TestProject.Form1.button7_Click(Object sender, EventArgs e) in C:\BACS\Projects\GCFHDWordServiceNew\TestProject\UnitTestForm.cs:line 317