Aspose epub表设置边框宽度

时间:2013-08-16 14:01:58

标签: c# .net aspose

我的问候!

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

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

编辑:

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

    /**
     * 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);
            }
       }
  }   

0 个答案:

没有答案
相关问题