Margin not being saved in conversion from HTML to .DOC


I am using an older version of aspose.word (2.1) and I have the following problem:

I have documents I read from .doc into HTML format and display in a Web textbox. The source indicates that there is a margin-left:252pt style on a P tag. When saved, the margin is saved as 0pt.

Will a newer version fix that? Will it require any upgrade cost?



Yes, please upgrade to the latest version of the component. If you purchased the license file before January 22, 2005, you should order the new license as described here:

Otherwise, no additional steps are required. If you continue experiencing the problem, please let us know and attach the problematic document to your post here.


Attached are samples. The aspose_lindenBefore (.doc and .html) are before I resave, the aspose_lindenAfter (.doc and .html) show the .doc and .html AFTER they have been saved through aspose.words latest version. Note that everything is left flush in the After document and html.


I tried to open your xxxBefore documents and save them to different formats. The indentation has been preserved. Please post your code which produces incorrect result (xxxAfter).


Here is the code. I am opening an existing document, and then clearing the main contents (so that I preserve the header/footer).

Aspose.Words.License lic=new Aspose.Words.License();
// Word.SetLicense(Page.MapPath("license/aspose.word.lic"),this);
Aspose.Words.Word word=new Aspose.Words.Word();
// Open Oegiginal Document
Aspose.Words.Document doc=new Aspose.Words.Document(this.strOriginalDocumentFilename);
try {
byte[] buffer=System.Text.Encoding.ASCII.GetBytes(this.FreeTextBox1.Text);
System.IO.MemoryStream ms=new MemoryStream(buffer);
Aspose.Words.Section sec=doc.Sections[0]; sec.ClearContent();
// doc.Sections[0].ClearStory(Aspose.Words.StoryType.MainTextStory);
Aspose.Words.DocumentBuilder db=new DocumentBuilder(doc);
// Insert HTML into existing document, to preserve header/footer...
} catch (Exception Ex) {
this.FreeTextBox1.Text="Document Not Found - Exception: " + Ex.ToString(); failedSave=true;
} finally {


Again, when I replace this.FreeTextBox1.Text with HTML read from your source document, the resulting document does keep all formatting including the indentation.

Please make sure that the HTML string passed to the InsertHtml method is correct, i.e. does contain proper paragraph margin. If nothing helps, we however must reproduce your issue to address. It would be great if you could zip and attach the part of your project which produces incorrect document. Is it possible?


Hmm. I cannot duplicate it either in a simple case. Obviously, something strange is happening…