Hi,
Here is the scenario. ASP.NET app.
I’m opening a word doc on the server, sending the html down to a browser editor (ckEditor), and then sending the html back to the server to be converted back again to a word doc.
We are losing formatting.
The main formatting appears to be around margins and toc. Here is the code I’m using as a POC:
string baseDir = @"C:\temp\WordsRoundtrip\WordsRoundtrip";
//ASPOSE License
Console.WriteLine("Reading license");
Aspose.Words.License license = new Aspose.Words.License();
var licensePath = Path.Combine(baseDir, "Aspose.Words.NET.lic");
license.SetLicense(licensePath);
string inFile = Path.Combine(baseDir, "Policy.docx");
string baseOutFile = "Policy_" + DateTime.Now.ToString("yyyy-MM-dd-HH-mm");
string outDocxFile = Path.Combine(baseDir, baseOutFile + ".docx");
//read in the doc
Console.WriteLine("Reading word doc");
Aspose.Words.Document doc = new Aspose.Words.Document(inFile);
//export the doc as html
Console.WriteLine("converting word doc to html");
MemoryStream ms = new MemoryStream();
Aspose.Words.Saving.HtmlSaveOptions options = new Aspose.Words.Saving.HtmlSaveOptions(Aspose.Words.SaveFormat.Html);
options.ExportImagesAsBase64 = true;
options.ExportRoundtripInformation = true;
doc.Save(ms, options);
//get the html and save a docx
Console.WriteLine("Saving html as word doc");
ms.Position = 0;
Aspose.Words.Document doc2 = new Aspose.Words.Document(ms);
doc2.Save(outDocxFile, Aspose.Words.SaveFormat.Docx);
Is there anything obvious I can change? I can send you a sample project if you want to duplicate.