2

我的问候!

我正在使用 Aspose lib 并将文件转换为 epub。问题是表格的默认边框宽度(在 Aspose 转换的文档中)是 0.5pt。在 nook 或 PC 上看起来一切都很好,但 iPad 或 HTML 浏览器不会呈现这些边框,因为它们的价值很小。只有当我放大 300% 时才会显示它们。我一直在尝试找到如何在 Aspose 中设置表格边框宽度,但没有运气。我发现了类似的东西:table.SetBorders(LineStyle, lineWidth(double), Color);,但它改变了一大堆参数。

您对如何为要转换为 epub 的文档设置表格的边框宽度有任何想法吗?

编辑:

好的,我尝试手动重置边框宽度,但是(惊喜!)所有边框变量值在调试模式下都是相同的,所以我无法只选择要修改的标准边框。这是代码:

    /**
     * Performs single table border linewidth increasing due to the bugged iPad epub rendering. 
     */
    private void reformatSingleBorderWidth(Border border)
    {
        if (border != null && border.LineWidth < 1.0 && border.LineStyle == LineStyle.None)
        {
            border.LineWidth = 1.0;
        }
    }


  foreach (Table table in doc.GetChildNodes(NodeType.Table, true)) {
      foreach (Row row in table.Rows) {
           foreach (Cell cell in row.Cells) {
                BorderCollection borders = cell.CellFormat.Borders;

                reformatSingleBorderWidth(borders.Left);
                reformatSingleBorderWidth(borders.Right);
                reformatSingleBorderWidth(borders.Top);
                reformatSingleBorderWidth(borders.Bottom);
            }
       }
  }   
4

0 回答 0