[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
立即试用
(Showing Draft Content)

CustomBorderStyle

Class CustomBorderStyle

java.lang.Object
com.grapecity.documents.excel.CustomBorderStyle

public class CustomBorderStyle extends Object
表示 PDF 导出时的自定义边框呈现选项。

将此类与 PdfSaveOptions.getBorderOptions() 一起使用,可以在工作簿导出为 PDF 时重写应用于特定 BorderLineStyle 的宽度和虚线模式。使用 setBorderWidth(double) 配置边框宽度,并使用 setDashes(ArrayList) 定义虚线线段。


 PdfSaveOptions options = new PdfSaveOptions();
 CustomBorderStyle borderStyle = new CustomBorderStyle();
 ArrayList<Double> dashes = new ArrayList<>();
 dashes.add(3.0);
 dashes.add(1.5);
 borderStyle.setBorderWidth(0.4);
 borderStyle.setDashes(dashes);
 options.getBorderOptions().put(BorderLineStyle.Dashed, borderStyle);
 
  • Constructor Details

    • CustomBorderStyle

      public CustomBorderStyle()
  • Method Details

    • getBorderWidth

      public final double getBorderWidth()
      获取导出为 PDF 时边框的宽度。

      使用此方法可在通过 PdfSaveOptions.getBorderOptions() 应用样式前,获取为此边框样式配置的自定义宽度。

      
       PdfSaveOptions options = new PdfSaveOptions();
       CustomBorderStyle borderStyle = new CustomBorderStyle();
       borderStyle.setBorderWidth(0.4);
       options.getBorderOptions().put(BorderLineStyle.Thin, borderStyle);
       double borderWidth = options.getBorderOptions().get(BorderLineStyle.Thin).getBorderWidth();
       
      Returns:
      为 PDF 导出配置的边框宽度。如果未设置自定义宽度,则返回 0。
    • setBorderWidth

      public final void setBorderWidth(double value)
      设置导出为 PDF 时边框的宽度。

      将此方法与 PdfSaveOptions.getBorderOptions() 一起使用,可以重写 PDF 导出期间应用于特定 BorderLineStyle 的宽度。

      
       PdfSaveOptions options = new PdfSaveOptions();
       CustomBorderStyle borderStyle = new CustomBorderStyle();
       borderStyle.setBorderWidth(0.4);
       options.getBorderOptions().put(BorderLineStyle.Thin, borderStyle);
       double borderWidth = options.getBorderOptions().get(BorderLineStyle.Thin).getBorderWidth();
       
      Parameters:
      value - PDF 导出期间要应用的边框宽度。
    • getDashes

      public final ArrayList<Double> getDashes()
      获取自定义边框样式使用的虚线模式。

      返回列表中的每一项都记录为 PDF 导出配置的虚线模式中一个线段的长度。

      
       PdfSaveOptions options = new PdfSaveOptions();
       CustomBorderStyle borderStyle = new CustomBorderStyle();
       ArrayList<Double> dashes = new ArrayList<>();
       dashes.add(3.0);
       dashes.add(1.5);
       borderStyle.setDashes(dashes);
       options.getBorderOptions().put(BorderLineStyle.Dashed, borderStyle);
       ArrayList<Double> dashPattern = options.getBorderOptions().get(BorderLineStyle.Dashed).getDashes();
       
      Returns:
      记录虚线模式中每个线段长度的列表;如果未设置虚线模式,则为 null。
    • setDashes

      public final void setDashes(ArrayList<Double> value)
      设置自定义边框样式使用的虚线模式。

      列表中的每个值都记录虚线模式中一个线段的长度。将此方法与 PdfSaveOptions.getBorderOptions() 一起使用,可以配置 PDF 导出期间特定 BorderLineStyle 的呈现方式。

      
       PdfSaveOptions options = new PdfSaveOptions();
       CustomBorderStyle borderStyle = new CustomBorderStyle();
       ArrayList<Double> dashes = new ArrayList<>();
       dashes.add(3.0);
       dashes.add(1.5);
       borderStyle.setDashes(dashes);
       options.getBorderOptions().put(BorderLineStyle.Dashed, borderStyle);
       ArrayList<Double> dashPattern = options.getBorderOptions().get(BorderLineStyle.Dashed).getDashes();
       
      Parameters:
      value - 记录虚线模式中每个线段长度的列表。此值可以为 null。