[]
        
(Showing Draft Content)

IShrinkToFitSettings

Interface IShrinkToFitSettings


public interface IShrinkToFitSettings
Represents the shrink to fit settings of this workbook.

Provides settings that control how wrapped text is reduced during PDF export so that the text can fit within the available cell area. Use PdfSaveOptions.getShrinkToFitSettings() to access this interface and configure whether wrapped text can shrink to fit and the minimum font size to use.


 worksheet.getRange("A1").setValue("Document Solutions For Excel");
 worksheet.getRange("A1").setColumnWidth(12);
 worksheet.getRange("A1").setWrapText(true);
 worksheet.getRange("A1").setShrinkToFit(true);

 PdfSaveOptions options = new PdfSaveOptions();
 IShrinkToFitSettings settings = options.getShrinkToFitSettings();
 settings.setCanShrinkToFitWrappedText(true);
 settings.setMinimumFont(10);
 workbook.save("path/to/output.pdf", options);
 
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Gets whether wrapped text can shrink to fit during PDF export.
    Gets the ellipsis string.
    double
    Gets the minimum font size used when performing shrink-to-fit processing.
    void
    Sets whether wrapped text can shrink to fit during PDF export.
    void
    Sets the ellipsis string.
    void
    setMinimumFont(double value)
    Sets the minimum font size used when performing shrink-to-fit processing.
  • Method Details

    • getCanShrinkToFitWrappedText

      boolean getCanShrinkToFitWrappedText()
      Gets whether wrapped text can shrink to fit during PDF export.

      Returns whether wrapped text is allowed to reduce its font size during PDF export when shrink-to-fit is applied.

      
       worksheet.getRange("A1").setValue("Document Solutions For Excel");
       worksheet.getRange("A1").setColumnWidth(12);
       worksheet.getRange("A1").setWrapText(true);
       worksheet.getRange("A1").setShrinkToFit(true);
      
       PdfSaveOptions options = new PdfSaveOptions();
       IShrinkToFitSettings settings = options.getShrinkToFitSettings();
       settings.setCanShrinkToFitWrappedText(true);
       boolean canShrinkWrappedText = settings.getCanShrinkToFitWrappedText();
       workbook.save("path/to/output.pdf", options);
       
      Returns:
      true if wrapped text can be shrunk to fit during PDF export; otherwise, false.
    • setCanShrinkToFitWrappedText

      void setCanShrinkToFitWrappedText(boolean value)
      Sets whether wrapped text can shrink to fit during PDF export.

      Sets whether wrapped text is allowed to reduce its font size during PDF export when shrink-to-fit is applied.

      
       worksheet.getRange("A1").setValue("Document Solutions For Excel");
       worksheet.getRange("A1").setColumnWidth(12);
       worksheet.getRange("A1").setWrapText(true);
       worksheet.getRange("A1").setShrinkToFit(true);
      
       PdfSaveOptions options = new PdfSaveOptions();
       IShrinkToFitSettings settings = options.getShrinkToFitSettings();
       settings.setCanShrinkToFitWrappedText(true);
       workbook.save("path/to/output.pdf", options);
       
      Parameters:
      value - true if wrapped text can be shrunk to fit during PDF export; otherwise, false.
    • getMinimumFont

      double getMinimumFont()
      Gets the minimum font size used when performing shrink-to-fit processing.

      This value specifies the smallest font size that can be used when wrapped text is reduced during shrink-to-fit processing.

      
       worksheet.getRange("A1").setValue("Document Solutions For Excel");
       worksheet.getRange("A1").setColumnWidth(12);
       worksheet.getRange("A1").setWrapText(true);
       worksheet.getRange("A1").setShrinkToFit(true);
      
       PdfSaveOptions options = new PdfSaveOptions();
       IShrinkToFitSettings settings = options.getShrinkToFitSettings();
       settings.setCanShrinkToFitWrappedText(true);
       settings.setMinimumFont(10);
       double minimumFont = settings.getMinimumFont();
       workbook.save("path/to/output.pdf", options);
       
      Returns:
      The minimum font size used during shrink-to-fit processing.
    • setMinimumFont

      void setMinimumFont(double value)
      Sets the minimum font size used when performing shrink-to-fit processing.

      This value specifies the smallest font size that can be used when wrapped text is reduced during shrink-to-fit processing.

      
       worksheet.getRange("A1").setValue("Document Solutions For Excel");
       worksheet.getRange("A1").setColumnWidth(12);
       worksheet.getRange("A1").setWrapText(true);
       worksheet.getRange("A1").setShrinkToFit(true);
      
       PdfSaveOptions options = new PdfSaveOptions();
       IShrinkToFitSettings settings = options.getShrinkToFitSettings();
       settings.setCanShrinkToFitWrappedText(true);
       settings.setMinimumFont(10);
       workbook.save("path/to/output.pdf", options);
       
      Parameters:
      value - The minimum font size used during shrink-to-fit processing.
    • getEllipsis

      String getEllipsis()
      Gets the ellipsis string. The default value is "...".

      This string is used when wrapped text is not fully displayed during shrink-to-fit processing. It can be used together with getMinimumFont() to control how truncated wrapped text is shown.

      
       worksheet.getRange("A1").setValue("Document Solutions For Excel");
       worksheet.getRange("A1").setColumnWidth(12);
       worksheet.getRange("A1").setWrapText(true);
       worksheet.getRange("A1").setShrinkToFit(true);
      
       PdfSaveOptions options = new PdfSaveOptions();
       IShrinkToFitSettings settings = options.getShrinkToFitSettings();
       settings.setCanShrinkToFitWrappedText(true);
       settings.setMinimumFont(10);
       settings.setEllipsis("~");
       String ellipsis = settings.getEllipsis();
       workbook.save("path/to/output.pdf", options);
       
      Returns:
      The ellipsis string used for wrapped text that cannot be fully displayed.
    • setEllipsis

      void setEllipsis(String value)
      Sets the ellipsis string. The default value is "...".

      This string is used when wrapped text is not fully displayed during shrink-to-fit processing. It can be used together with getMinimumFont() to control how truncated wrapped text is shown.

      
       worksheet.getRange("A1").setValue("Document Solutions For Excel");
       worksheet.getRange("A1").setColumnWidth(12);
       worksheet.getRange("A1").setWrapText(true);
       worksheet.getRange("A1").setShrinkToFit(true);
      
       PdfSaveOptions options = new PdfSaveOptions();
       IShrinkToFitSettings settings = options.getShrinkToFitSettings();
       settings.setCanShrinkToFitWrappedText(true);
       settings.setMinimumFont(10);
       settings.setEllipsis("~");
       workbook.save("path/to/output.pdf", options);
       
      Parameters:
      value - The ellipsis string used for wrapped text that cannot be fully displayed.