We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Filesize differs when saving vs open -> save

Hi!

I use the Aspose.Words to generate a rtf-document with the following code:

doc.Save(“thefile.rtf”, Aspose.Words.SaveFormat.Rtf, Aspose.Words.SaveType.OpenInWord, this.Response);

When this is called a window is opened at the client where they can choose between open and save. If its opened and saved through word, the filesize is quite small. If the user saves without open all the content of the content, including hidden, is saved making the file quite much larger.

Anyone got a tip in how to exclude hidden content/reducing filesize when saving without opening the file?

Hello!

Thank you for your inquiry.

File size can vary if the same document is being saved by MS Word and Aspose.Words. Hidden contents are not the only reason. 10-20% maybe okay but if you get difference several times as it was saved by MS Word we’ll try to take measures. Please attach the original MS Word file which is further exported to RTF.

Regards,

Hi Klepus!

Se attached zip. Both are created by creating the file from a webpage where the Save() method is called. The first file is saved when prompted. The other is opened in Word when prompted, and then saved manually to rtf.

  1. File: test_instant_save.rtf

  2. File: test_open_and_save_in_word.rtf

Hi

Thank you for additional information. Just add Reponse.End() after sending document to a client browser as shown in the following code:

//Open a word document

Document doc = new Document(@“C:\Temp\in.doc”);

//Save the document in RTF format and send to client browser

doc.Save(“out.rtf”, SaveFormat.Rtf, SaveType.OpenInWord, Response);

Response.End();

This will resolve the problem.

Best regards.

Works perfectly!

Many thanks!