Hi,
We’re using your product to convert HTML to various formats. We’re having a problem with the attached document Template.HTML.
The C# code we’re using:
static void DoPDF(string[] args)
{
using (MemoryStream inStream = new MemoryStream(File.ReadAllBytes(@“C:\Temp\Template.html”)))
{
using (MemoryStream outStream = new MemoryStream())
{
Document d = new Document(inStream);
// workaround for bug Issue with Colspan and HTML to PDF
RemoveContentFromMergedCells(d);
// we use our own enum value so we’re not tied to using Aspose for this service, but we need to convert between the enums
SaveFormat saveFormat = SaveFormat.Pdf;
d.Save(outStream, saveFormat);
File.WriteAllBytes(@“C:\Temp\out.pdf”, outStream.ToArray());
}
}
}
///
/// Remove content from merged cells.
///
public static void RemoveContentFromMergedCells(Document doc)
{
// Get collection of cells in the docuemnt.
NodeCollection cells = doc.GetChildNodes(NodeType.Cell, true);
foreach (Aspose.Words.Tables.Cell cell in cells)
{
// Check whether cell is merged with previouse.
if (cell.CellFormat.HorizontalMerge == CellMerge.Previous ||
cell.CellFormat.VerticalMerge == CellMerge.Previous)
{
// Remove content from the cell.
cell.RemoveAllChildren();
}
}
}
The main problem is with the merged Cells that are not closed properly but with some weird diagonal lines.
Aspose.Words - Runtime Version: v2.0.50727 - Version: 6.4.0.0
Aspose.Cells - Runtime Version: v2.0.50727 - Version: 4.7.1.0
Can you explain and provide a fix or a workaround?
Thank you,
Mihai Petcov