Corrupted Document Open Office 3.2

Hello,

i’m using the latest version of Aspose and Open Office and my target framework is 3.0
I’m having problems with the ODT files.
When i create a new document:

string sModelPath = System.Web.HttpContext.Current.Server.MapPath(String.Concat("Models\letter.odt"));
Document oDoc = new Document(sModelPath);

And save it to my computer with:

SaveFormat oSave = SaveFormat.None;

switch (sExt)
{
    case "docx":
        oSave = SaveFormat.Docx;
        break;
    case "docm":
        oSave = SaveFormat.Docm;
        break;
    case "doc":
        oSave = SaveFormat.Doc;
        break;
    case "odt":
        oSave = SaveFormat.Odt;
        break;
    case "pdf":
        oSave = SaveFormat.Pdf;
        break;
    case "xps":
        oSave = SaveFormat.Xps;
        break;
    case "rtf":
        oSave = SaveFormat.Rtf;
        break;
}

oDoc.Save(String.Concat(sModel, ".", sExt), oSave, SaveType.OpenInApplication, Response);

The letter.odt which i downloaded with my browser, is corrupt! Open Office tells me the document needs to be repaired. Letter.odt is a new empty document…

Hi

Thanks for your request. The problem might occur because content of your page is appended to the end of the file. You can prevent this by adding Response.End() as shown below:

doc.Save("test.odt", SaveFormat.Odt, SaveType.OpenInApplication, Response);
Response.End();

If this will not help, please attach your input document and output ODT.
Best regards.

Thanks, Response.End() fixxed my problem!