Tables issue - new version

I’ve recently updated my Aspose to the newest version & the table formatting of some created tables is messed up.
_lst.doc - document created by the older version of Aspose - correct
_lst2.doc - document created by new version of Aspose 10.1.0
See how headers are missing in new document in second column(ex: Extension, Rotation…)

Please help ASAP!!

This is the code I use to create the table in the document(the values are passed in based on the row.

AddRow(docbuilder, new string[1]
{
    "BACK:"
}, "hdr1");
AddRow(docbuilder, new string[2]
{
    "Flexion (0 to 90 degrees):",
    "Extension (0 to 30 degrees):"
});
AddRow(docbuilder, new string[4]
{
    GetValue(txtRMLSFlx), "", GetValue(txtRMLSExt), ""
});
AddRow(docbuilder, new string[2]
{
    "Lateral Bending (0 to 25 degrees):",
    "Rotation (0 to 45 degrees):"
});

public static void AddRow(DocumentBuilder docbuilder, string[] cellcontents, string format)
{

    if (format == "hdr1")
    {
        docbuilder.Bold = true;
        docbuilder.Underline = Underline.Single;
    }
    else if (format == "hdr2")
    {
        docbuilder.Bold = false;
        docbuilder.Underline = Underline.Single;
    }
    else
    {
        docbuilder.Bold = false;
        docbuilder.Underline = Underline.None;
    }
    docbuilder.InsertCell();
    if (cellcontents.Length == 4 && cellcontents[1] != "")
    {
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.None;
        docbuilder.CellFormat.Width = 100;
        docbuilder.Write(" Left: " + cellcontents[0]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.Write("Right: " + cellcontents[1]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        if (cellcontents[2] != "")
            docbuilder.Write(" Left: " + cellcontents[2]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        if (cellcontents[3] != "")
            docbuilder.Write("Right: " + cellcontents[3]);
    }
    else if (cellcontents.Length == 4)
    {
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.None;
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.None;
        docbuilder.CellFormat.Width = 100;
        docbuilder.Write(" " + cellcontents[0]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.Write(cellcontents[1]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.Write(" " + cellcontents[2]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.Write(cellcontents[3]);
    }
    else if (cellcontents.Length == 2)
    {
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
        docbuilder.CellFormat.Width = 100;
        docbuilder.Write(cellcontents[0]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.Previous;
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
        docbuilder.Write(cellcontents[1]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.Previous;
    }
    else if (cellcontents.Length == 1)
    {
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.First;
        docbuilder.CellFormat.Width = 100;
        docbuilder.Write(cellcontents[0]);
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.Previous;
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.Previous;
        docbuilder.InsertCell();
        docbuilder.CellFormat.Width = 100;
        docbuilder.CellFormat.HorizontalMerge = Aspose.Words.Tables.CellMerge.Previous;
    }
    docbuilder.EndRow();
}

Hello
Thanks for your request. Actually, I cannot see any differences between tables inside the attached documents (the difference is just between the data inside tables). And I have tested your code in the following way:

Document doc = new Document();
DocumentBuilder docbuilder = new DocumentBuilder(doc);
AddRow(docbuilder, new string[1]
{
    "BACK:"
}, "hdr1");
AddRow(docbuilder, new string[2]
{
    "Flexion (0 to 90 degrees):",
    "Extension (0 to 30 degrees):"
}, "hdr1");
AddRow(docbuilder, new string[4]
{
    "Test1",
    "",
    "Test2",
    ""
}, "hdr1");
AddRow(docbuilder, new string[2]
{
    "Lateral Bending (0 to 25 degrees):",
    "Rotation (0 to 45 degrees):"
}, "hdr1");
// Save the result as DOC.
doc.Save("C:\\Temp\\out.doc", SaveFormat.Doc);

As I can see it works as expected.
Best regards,

I did some more research & saw some other posts. It seems there is a bug with cell merge in the latest version of Aspose(which is supposed to be fixed in the next version). I updated my code to use individual cells set to a specific width, based on the workaround for those posts & it’s working ok now.

Does this make sense?

Hi Melisa,
Thank you for additional information. Yes, there was a problem with horizontally merged cells in DOC format. If this is the same problem as you have, then if you save the output as DOCX it should look as expected.
The fix will be included into the next version of Aspose.Words that comes out at the end of this month. We will notify you.
Best regards,

The issues you have found earlier (filed as WORDSNET-4734) have been fixed in this .NET update and in this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(10)