Html alignment issue

Hi,
Please create a html using Aspose.HTML save format from the attached word file [ this word file is created by aspose code, includes horizontal and vertical merges] and see that the word file and html are not looking alike.


Document doc = new Document(@"C:\AsposeDoc.doc");
doc.Save(@"C:\AsposeHTML.html", SaveFormat.Html);

Please advice.
Ali

Hello!
Thank you for your inquiry.
I performed some experiments with this case. It seems that cell height is not set properly when cells are merged. Please supply your code creating this document. There would be also useful to know why you need such a table. Maybe I would be able to invent a workaround for you.
Regards,

Hi,
Any comment on this?
Regards,
Ali

Hi
Thanks for your request. Could you please provide your code you are using for creating such document? We will investigate the issue and provide you more information.
Best regards.

Hi,
Please see the below code and attachment. This code is supposed to be generated dynamically according to the business requirement. The use desings a pattern as shown in the attached figure. I have regenerated the code statically for you. For the horizontal merge, for best result, we add the cell width of the following cells to the first cell and set the width of the following cells to zero if the column span > 1 [for eg: if a cell has colspan 2, if width of the cell is 100 and of next cell is 100, the width of the cell is set to 200 and second cell to 0 , and then merge them]. Height of the rows are not done in this way since height is set for the entire row. Please see the word doc and HTML generated by the below code and see the difference. Please tell us a solution for the height difference if possilble.
Regards,
Ali.
*Code

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
// first row
builder.RowFormat.Height = 50;
builder.InsertCell();
builder.CellFormat.Width = 200;
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.InsertCell();
builder.CellFormat.Width = 0;
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.InsertCell();
builder.CellFormat.Width = 100;
builder.CellFormat.HorizontalMerge = CellMerge.None;
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.InsertCell();
builder.CellFormat.Width = 100;
builder.CellFormat.HorizontalMerge = CellMerge.None;
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.EndRow();
// second row
builder.RowFormat.Height = 100;
builder.InsertCell();
builder.CellFormat.Width = 200;
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.Width = 0;
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.Width = 200;
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.InsertCell();
builder.CellFormat.Width = 0;
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.CellFormat.VerticalMerge = CellMerge.First;
builder.EndRow();
// third row
builder.RowFormat.Height = 50;
builder.InsertCell();
builder.CellFormat.Width = 200;
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.InsertCell();
builder.CellFormat.Width = 0;
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.CellFormat.VerticalMerge = CellMerge.None;
builder.InsertCell();
builder.CellFormat.Width = 200;
builder.CellFormat.HorizontalMerge = CellMerge.First;
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.InsertCell();
builder.CellFormat.Width = 0;
builder.CellFormat.HorizontalMerge = CellMerge.Previous;
builder.CellFormat.VerticalMerge = CellMerge.Previous;
builder.EndRow();
builder.EndTable();
// save as doc
// save as HTML

Hi
Thanks for your inquiry. There is simple solution for your problem. Just use HeightRule.Exactly or HeightRule.AtLeast as shown below.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.CellFormat.Borders.LineStyle = LineStyle.Single;
builder.RowFormat.HeightRule = HeightRule.Exactly;
builder.RowFormat.Height = 50;

I also created new issue in our defect database #6133.
Best regards.