[]
        
(Showing Draft Content)

CustomBorderStyle

Class CustomBorderStyle

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

public class CustomBorderStyle extends Object
Represents custom border rendering options for PDF export.

Use this class with PdfSaveOptions.getBorderOptions() to override the width and dash pattern applied to a specific BorderLineStyle when a workbook is exported to PDF. Configure the border width with setBorderWidth(double) and define dashed segments with 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()
      Gets the width of a border when exporting to PDF.

      Use this method to retrieve the custom width configured for this border style before the style is applied through 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:
      The border width configured for PDF export. Returns 0 if no custom width has been set.
    • setBorderWidth

      public final void setBorderWidth(double value)
      Sets the width of a border when exporting to PDF.

      Use this method with PdfSaveOptions.getBorderOptions() to override the width applied to a specific BorderLineStyle during PDF export.

      
       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 - The border width to apply during PDF export.
    • getDashes

      public final ArrayList<Double> getDashes()
      Gets the dash pattern used for the custom border style.

      Each item in the returned list records the length of one segment in the dashed line pattern configured for PDF export.

      
       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:
      The list that records the length of each segment in the dashed line pattern, or null if no dash pattern has been set.
    • setDashes

      public final void setDashes(ArrayList<Double> value)
      Sets the dash pattern used for the custom border style.

      Each value in the list records the length of one segment in the dashed line pattern. Use this method together with PdfSaveOptions.getBorderOptions() to configure how a specific BorderLineStyle is rendered during PDF export.

      
       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 - The list that records the length of each segment in the dashed line pattern. This value may be null.