Free Support Forum -

XML Table column widths

I am trying to create a document that has a table with 2 colums where one of the columns may contain a HTML table. The document is built by opening a Word document that is used as a template that contains the table and Mail Merge fields. The document may have had multiple documents of this type appended together.

The problem I am having is that while the document I create "looks" correct, when using Aspose Pdf to conver the doc to a pdf, the column widths are not maintained. The Aspose Pdf team says the variation in the column widths is an Aspose Words problem because the column widths in the XML are incorrect and they can't fix it on their side.

I attached the doc and resulting pdf for you to look at.

Thanks for reporting this issue to us. I will research it and let you know soon.

Best regards,

Can I get an idea when you might be able to look at this problem? I am getting hammered because we can’t do 2 columm format. I am trying to replace a long standing print publication. We had a lot of problems with Aspose Pdf getting all the issues solved and this is the last item.

This defect is logged to our defect base as issue #1469. We will try to fix it by the the time of the next release in 2-3 weeks. Sorry for inconvenience.

Best regards,

Actually I received a reply from the Pdf group that the latest Words release fixed this problem. I still have an issue with the column widths though. I attached a zip that contains the doc, pdf and template doc that my proess uses. You will see that the colums in the Word doc look correct but the section of the pdf that contains a html table has a different column widths than the other sections.

Two other issues I need to correct are getting the sections to flow together and not start on a separate page. This may just be a format issue with the template doc but I don't know what to change. The paragraphs flow correctly if I am not using tables.

The last issue is empty cells in the right hand column. I have a differnt process that uses a 2 column table where the rows span both colums. I use this code to remove empty rows:

while (RemoveEmptyRows(doc)) { };

bool RemoveEmptyRows(Document doc)
bool emptyRow = true;
foreach (Aspose.Words.Section section in doc.Sections)

foreach (Aspose.Words.Table table in section.Body.Tables)

foreach (Aspose.Words.Row row in table.Rows)

foreach (Aspose.Words.Cell cell in row.Cells)

string c = cell.GetText().Trim();
emptyRow = (c == "\a");
if (emptyRow)
return emptyRow;


If I move the if(emptyRow) Row.Remove under the emptyRow = (c == "\a");
and change it to cell.remove the formatting of the table gets messed up. How can I remove empty rows/cells from the right hand column only?

sorry, forgot to attach zip

Yes, the issue with column widths are logged as a defect. we will deal with it shortly.

Section flow problem is most probably related to Aspose.Pdf as the page layout is made mostly by them.

To remove empty cell from right column, while your left column is a big merged cell should be done by removing the whole row. Otherwise, you will get an empty place instead of the removed cell.

Hope this helps,

Acctually the sections not flowing together is happening in the word doc. If you look at the sample I sent you will see what I mean.

I am not sure what you meant about deleting the table row. If I have a table like this:


| Col1 |----Col2 R1-------|

| |------R2-----------|

| |------R3-----------|


How do I remove a row from Col2 without affecting what is in Col 1?

If you want to keep sections together you need to insert section break of the type continuous, not next page. In MS Word it is controlled in Insert | Break menu. In Aspose.Words it is controlled by Section.PageSetup.SectionStart property.

Concerning cells removal. In your PrintTemplate.doc example I can see the table that has nine cells in the right column and only one cell in the left column. But that does not mean that the table has 1 row in the first column and 9 rows in the second. The MS Word's tables can never be made like this. They consist of the rows, not of the columns. And each row consist of some arbitrary amount of cells and that number can vary from row to row. So the row is the basic dividing unit of the table. And columns are just some artificial characteristics based on the fact that borders of cells in one row are sometimes aligned with the cells in the other row. Keeping this in mind, we can tell that in your table the cells of the first column are also numbered nine, but they are just vertically merge with the top cell. That means that you can safely remove the row containing the empty cell in the right column. That won't make any difference for the left column, unless you are deleteing the first row. For the first row removal some additional steps shoul be taken when removing it.

The small code sample below effectively removes the empty cell in the right column of PrintTemplate.doc by removing the row that contains it. As you will see it won't affect left column or the table formatting.

doc.FirstSection.Body.Tables[0].RowsMusic [8].Remove();

Hope this helps. Please let me know if you have further questions.


I was wondering if there has been any progress on item #1469? I think this is the last Aspose issue I needed to get cleared up. My client is getting testy, if you have an interim build that I could use to demo the corrected output that would be a real big help.


Unfortunately, no news on this matter. The hotfix is still several days away and we didn't plan to release special builds until that moment. Thank you for understanding.

I was doing some additional testing and I had thought the variation in the column widths occured when there was an html table in the right hand table cell. Now it seems that the html table was not the cause, I get variations between documents with no table in the cell, so I guess it is a general problem with the way the width values are generated. Strange that it looks good in Word.

Thank you for this additional information. I believe we will fix the issue shortly.

I hope you can get me something very soon. My project is late and a large portion of the lateness has been because of problems with both Aspose Words and Aspsoe Pdf. Since the end of November I had had to make 70+ post here to deal with problems. My management is at the point of having me look into alternate solutions. They have been holding off on purchasing Aspose Pdf (we already have Words on another project) until after all the problems have been worked out. If I have to cut in a replacement product at this point it is going to be a big problem for all concerned. The Aspose Pdf team has been very helpful providing a hotfix dll when they solve problems for me, I was hoping you could do the same.

Sorry for inconvenience. We will try to release a hotfix or at least a special build in 1-2 days.

We will try to fix the bugs in Aspose.Pdf side early next week.

Let me explain. I have fixed a bug in Aspose.Words, it made the column a bit wider due to a long hyperlink containing hyphens. Sadly, another issue was unveiled, this time caused by Aspose.PDF. So we are waiting for Aspose.PDF team to fix and release. We apologize again.

please check out the last few posts on this thread:

There are still some problems with the column widths.

Ok, I see. I will research the issue and let you know tomorrow.

Best regards,

We are now working on this issue together with Aspose.Pdf team.

Best regards,