I want to make the group of DIV elements in the attached HTML file appear as a table in a Word document created by Aspose.Words for .NET. However, Aspose.Words never creates a table format for these DIVs: it always breaks every DIV in a new row in the Word file.
If you drag and drop the HTML file in any browser (IE, FF, Chrome, etc.) you’ll see that all browsers will properly create the table layout (rows and cells) for the group of DIVs.
To replicate the issue, just copy and paste the piece of C# code below in the Main() method of a console project, put the attached “Test.html” file in the C:\ directory and make sure you’re loading the Aspose.Words.dll 10.6.0.0 assembly (you can get the issue with the newest component version):
License license = new License(); license.SetLicense("Aspose.Words.lic"); LoadOptions lo = new LoadOptions(); lo.LoadFormat = LoadFormat.Html; SaveOptions soOptions = SaveOptions.CreateSaveOptions(SaveFormat.Docx); Document doc = new Document(@"C:\Test.txt", lo); doc.Save(@"C:\Test.docx", soOptions);
Another interesting thing: I see that the “RW1” CSS style is never applied to the internal DIVs as well. It only works if I explictly assign class=“RW1” for each inner DIV like you can see for the RW2 CSS style in the first DIV (the one loading the image). Duhh… How could I easily apply the CSS style across all of the internal DIVs in an easy, simple way?
Does anybody know what I’m missing here?