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

Free Support Forum - aspose.com

Column width is not properly aligned while Inserting data into html table


I am using documentbuilder.insertHtml to render the table to view the in html format.
I am trying to merge data into the table defined in html format .
when the data for a cell is more than the cell width the cell’s are getting expanded . the column are not aligned properly.

here is the html code for table

RowNumber> Contravention Location RemedyText Group10

I am attaching the generated out put and the excepted output.
can any one please help on how to get the columns with proper alignment

we are using java 1.5 and aspose 10.4.0 jar .
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
<span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;


Thanks for your inquiry. While using latest version of Aspose.Words v.11.0.0, i could not reproduce this problem. I will suggest you to use latest version of Aspose.Words. I have attached output document as well.


Thanks for you reply.

I had tried with the latest Aspose.words v.11.0 jar. but still problem occurring.

I have found that the generated table format (HtmlOutDoc.doc) is not fully derived from the HTML content which i gave on 31st Jan 2012. Because, the column width defined in HTML is as follows, 20,160,160,160,160. I wants to be place the data content within the allotted cell width, even though either cell data is empty or lengthy text, cell border should not shrink or expand.

More Info: I have bookmark to place the table in particlar place in the document.

Please provide solution for this.

I have attached the sample document with the name of MoreInfo.doc
Hi Rajesh,

Thanks for your inquiry. I am afraid, i am still unable to reproduce this issue on my end. I have attached input / output files.

Please share your input html file along with complete data table for further analysis.

Code snippet:

public static void InsertHtml()throws Exception
Document doc = new Document("c:/temp/document.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
StringBuilder htmlText = new StringBuilder();
BufferedReader reader = new BufferedReader(new FileReader("c:/temp/htmlTable.html"));
String line;
while ((line = reader.readLine()) != null) {
String html = htmlText.toString();

// Save resulting document with a new name.

Hope this will help.


Table format is aligning properly, while giving the cell width for particular . Eg. …


Hi Rajesh,

Thanks for your details. It is great to hear that your issue has been resolved. You are always welcome and please feel free to ask if you have any query in future.

We always welcome constructive response from our customers.