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

Hi,

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

<table border="1" cellspacing="0" style="table-layout:fixed; width = 700px">
    <col width=20>
    <col width=160>
    <col width=160>
    <col width=160>
    <col width=160>
    <tr>
        <td>RowNumber></td>
        <td>Contravention</td>
        <td>Location</td>
        <td>RemedyText</td>
        <td>Group10</td>
    </tr>
</table>

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 .
Thanks,
Rajesh

Hi
Rajesh,

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.

Hi,

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);
    builder.moveToBookmark("TablePostion");
    StringBuilder htmlText = new StringBuilder();
    BufferedReader reader = new BufferedReader(new FileReader("c:/temp/htmlTable.html"));
    String line;
    while ((line = reader.readLine()) != null)
    {
        htmlText.append(line);
        htmlText.append("\r\n");
    }
    String html = htmlText.toString();
    builder.insertHtml(html);

    // Save resulting document with a new name.
    doc.save("c:/temp/htmlTableOut2.doc");
}

Hope this will help.

Hi,

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

Thanks

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.