We are using aspose word for HTML to docx conversion. To set the page level background we created a table in the background and set the cell color. It works fine when we have the single page or just the two column layout but it fails when we have two rows and the second row has two column. Please check the attachment for details.
Our problem is to stretch the second-row first column background color till the end of the page even there is no text.
What we have tried:
We have added a third row programmatically to fill the remaining document as we want to extend the shape/color on left side till the end of every page independent of whether text exists or not till the end or not. Left-hand side color should be rendered for every page.
We are looking for a way to find out the rendered height which we can use for last table cell as right now we have hardcoded it.
The first section(with black background) in the document which contains name is a row and rest of the data is present in the second row. We tried fixing second-row height equal to doc height but then the second row would render in a separate page.
Below is the code snippet that we use to add the third row in our doc:
Row rowLast = new Row(doc); Cell cellOne = new Cell(doc); cellOne.CellFormat.Borders.ClearFormatting(); cellOne.CellFormat.Width = table.Rows.Cells.CellFormat.Width; cellOne.CellFormat.Shading.BackgroundPatternColor = table.Rows.Cells.CellFormat.Shading.BackgroundPatternColor; Cell cellTwo = new Cell(doc); cellTwo.CellFormat.Width = table.Rows.Cells.CellFormat.Width; cellTwo.CellFormat.Borders.ClearFormatting(); cellTwo.CellFormat.Shading.BackgroundPatternColor = table.Rows.Cells.CellFormat.Shading.BackgroundPatternColor; rowLast.RowFormat.Height = 261; rowLast.RowFormat.HeightRule = HeightRule.AtLeast; rowLast.AppendChild(cellOne); rowLast.AppendChild(cellTwo); rowLast.RowFormat.Borders.ClearFormatting(); table.AppendChild(rowLast);
Please check the attached docx.
Sample Docx.zip (75.6 KB)
Attachemnt contains three docx files one it the our desired output.
Second that we are getting right now.
Third, we tried to set the second at least heigh to page height but this creates the gap between first and second row.