com.groupdocs.editor.options

Class SpreadsheetSaveOptions

  • All Implemented Interfaces:
    ISaveOptions


    public final class SpreadsheetSaveOptions
    extends Object
    implements ISaveOptions

    Allows to specify custom options for generating and saving Spreadsheet (Excel-compliant) documents

    • Constructor Summary

      Constructors 
      Constructor and Description
      SpreadsheetSaveOptions(SpreadsheetFormats outputFormat)
      Creates a new instance of SpreadsheetSaveOptions with specified mandatory Spreadsheet output format, while all other parameters are default
    • Method Summary

      Methods 
      Modifier and Type Method and Description
      boolean getInsertAsNewWorksheet()
      Boolean flag, which specifies whether edited worksheet should replace the existing worksheet in original spreadsheet on the position, specified by the WorksheetNumber(getWorksheetNumber()/setWorksheetNumber(int)) property, or it should be injected between existing worksheet and previous one, without replacing its content.
      SpreadsheetFormats getOutputFormat()
      Allows to specify a Spreadsheet format, which will be used for saving the document
      String getPassword()
      Allows to specify, modify, obtain, or remove a password, which will be used to encode the generated Spreadsheet document, if tis document format supports password protection.
      int getWorksheetNumber()
      Allows to insert edited worksheet into copy of existing spreadsheet instead of creating a new single-worksheet spreadsheet (default behavior).
      WorksheetProtection getWorksheetProtection()
      Allows to enable a worksheet protection for the output Spreadsheet document.
      void setInsertAsNewWorksheet(boolean value)
      Boolean flag, which specifies whether edited worksheet should replace the existing worksheet in original spreadsheet on the position, specified by the WorksheetNumber(getWorksheetNumber()/setWorksheetNumber(int)) property, or it should be injected between existing worksheet and previous one, without replacing its content.
      void setOutputFormat(SpreadsheetFormats value)
      Allows to specify a Spreadsheet format, which will be used for saving the document
      void setPassword(String value)
      Allows to specify, modify, obtain, or remove a password, which will be used to encode the generated Spreadsheet document, if tis document format supports password protection.
      void setWorksheetNumber(int value)
      Allows to insert edited worksheet into copy of existing spreadsheet instead of creating a new single-worksheet spreadsheet (default behavior).
      void setWorksheetProtection(WorksheetProtection value)
      Allows to enable a worksheet protection for the output Spreadsheet document.
    • Constructor Detail

      • SpreadsheetSaveOptions

        public SpreadsheetSaveOptions(SpreadsheetFormats outputFormat)

        Creates a new instance of SpreadsheetSaveOptions with specified mandatory Spreadsheet output format, while all other parameters are default

        Parameters:
        outputFormat - Mandatory output format, in which the Spreadsheet document should be saved
    • Method Detail

      • getInsertAsNewWorksheet

        public final boolean getInsertAsNewWorksheet()

        Boolean flag, which specifies whether edited worksheet should replace the existing worksheet in original spreadsheet on the position, specified by the WorksheetNumber(getWorksheetNumber()/setWorksheetNumber(int)) property, or it should be injected between existing worksheet and previous one, without replacing its content. By default is false — existing worksheet will be replaced. This property is ignored, if value of WorksheetNumber(getWorksheetNumber()/setWorksheetNumber(int)) property is set to '0'.


        By default worksheet is replaced. This means that if given spreadsheet has 5 worksheets, and WorksheetNumber(getWorksheetNumber()/setWorksheetNumber(int))=4, then 4th worksheet will be replaced with the new edited worksheet, while the total amount of worksheets in spreadsheet (5) will remain untouched. However, if value of this property is set to <i>true</i>, the new edited worksheet will be injected as 4th worksheet, and all subsequent worksheets will be shifted to the end: "old" 4th worksheet becomes 5th, and 5th becomes 6th, and the total amount of worksheets in spreadsheet will be incremented by one and equal to 6.
        Returns:
      • getOutputFormat

        public final SpreadsheetFormats getOutputFormat()

        Allows to specify a Spreadsheet format, which will be used for saving the document

        Returns:
      • getPassword

        public final String getPassword()

        Allows to specify, modify, obtain, or remove a password, which will be used to encode the generated Spreadsheet document, if tis document format supports password protection. Specify NULL or empty string for removing (cleaning) the password.

        Returns:
      • getWorksheetNumber

        public final int getWorksheetNumber()

        Allows to insert edited worksheet into copy of existing spreadsheet instead of creating a new single-worksheet spreadsheet (default behavior). WorksheetNumber is a 1-based number of a worksheet in the spreadsheet, loaded in the Editor class. If it is 0 (default value), the new spreadsheet will be created with single edited worksheet. If it is greater or lesser then zero, and there is valid spreadsheet, loaded in the Editor class, the edited worksheet, that is represented by input EditableDocument instance, will be inserted into this spreadsheet.


        Given spreadsheet has 5 worksheets:
         WorksheetNumber  = 0; — ignore given spreadsheet, create a new spreadsheet and put edited worksheet into it.
         WorksheetNumber  = 1; — replace the first worksheet with edited
         WorksheetNumber  = 2; — replace the second worksheet with edited
         WorksheetNumber  = 5; — replace the last (5th) worksheet with edited
         WorksheetNumber  = 6; — replace the last (5th) worksheet with edited, because 6 is greater then 5 and thus is adjusted
         WorksheetNumber = -1; — replace the last (5th) worksheet with edited, because "-1" means "last existing"
         WorksheetNumber = -2; — replace the 4th worksheet with edited
         WorksheetNumber = -3; — replace the 3rd worksheet with edited
         WorksheetNumber = -4; — replace the 2nd worksheet with edited
         WorksheetNumber = -5; — replace the first worksheet with edited
         WorksheetNumber = -6; — replace the first worksheet with edited, because "-6" is greater then 5 and thus is adjusted
         


        <i>WorksheetNumber</i> integer property, if it is not in default state (reserved value '0'), represents a worksheet number, so it starts from 1, not from zero, and its max value is the amount of all existing slides in a presentation. However, if specified value is greater then amount of all slides, GroupDocs.Editor will adjust it to mark the last worksheet. Negative values are also allowed and count worksheets from end. For example, "-1" implies last worksheet in a spreadsheet, "-2" — last but one, etc. Like with positive values, when negative worksheet number exceeds the total count of worksheets in the given spreadsheet, it will be adjusted to the first worksheet. The InsertAsNewWorksheet(getInsertAsNewWorksheet()/setInsertAsNewWorksheet(boolean)) boolean property is tightly coupled with this one.
        Returns:
      • getWorksheetProtection

        public final WorksheetProtection getWorksheetProtection()

        Allows to enable a worksheet protection for the output Spreadsheet document. By default is NULL - protection is not applied. Not all formats support a worksheet protection.

        Returns:
      • setInsertAsNewWorksheet

        public final void setInsertAsNewWorksheet(boolean value)

        Boolean flag, which specifies whether edited worksheet should replace the existing worksheet in original spreadsheet on the position, specified by the WorksheetNumber(getWorksheetNumber()/setWorksheetNumber(int)) property, or it should be injected between existing worksheet and previous one, without replacing its content. By default is false — existing worksheet will be replaced. This property is ignored, if value of WorksheetNumber(getWorksheetNumber()/setWorksheetNumber(int)) property is set to '0'.


        By default worksheet is replaced. This means that if given spreadsheet has 5 worksheets, and WorksheetNumber(getWorksheetNumber()/setWorksheetNumber(int))=4, then 4th worksheet will be replaced with the new edited worksheet, while the total amount of worksheets in spreadsheet (5) will remain untouched. However, if value of this property is set to <i>true</i>, the new edited worksheet will be injected as 4th worksheet, and all subsequent worksheets will be shifted to the end: "old" 4th worksheet becomes 5th, and 5th becomes 6th, and the total amount of worksheets in spreadsheet will be incremented by one and equal to 6.
        Parameters:
        value -
      • setOutputFormat

        public final void setOutputFormat(SpreadsheetFormats value)

        Allows to specify a Spreadsheet format, which will be used for saving the document

        Parameters:
        value -
      • setPassword

        public final void setPassword(String value)

        Allows to specify, modify, obtain, or remove a password, which will be used to encode the generated Spreadsheet document, if tis document format supports password protection. Specify NULL or empty string for removing (cleaning) the password.

        Parameters:
        value -
      • setWorksheetNumber

        public final void setWorksheetNumber(int value)

        Allows to insert edited worksheet into copy of existing spreadsheet instead of creating a new single-worksheet spreadsheet (default behavior). WorksheetNumber is a 1-based number of a worksheet in the spreadsheet, loaded in the Editor class. If it is 0 (default value), the new spreadsheet will be created with single edited worksheet. If it is greater or lesser then zero, and there is valid spreadsheet, loaded in the Editor class, the edited worksheet, that is represented by input EditableDocument instance, will be inserted into this spreadsheet.


        Given spreadsheet has 5 worksheets:
         WorksheetNumber  = 0; — ignore given spreadsheet, create a new spreadsheet and put edited worksheet into it.
         WorksheetNumber  = 1; — replace the first worksheet with edited
         WorksheetNumber  = 2; — replace the second worksheet with edited
         WorksheetNumber  = 5; — replace the last (5th) worksheet with edited
         WorksheetNumber  = 6; — replace the last (5th) worksheet with edited, because 6 is greater then 5 and thus is adjusted
         WorksheetNumber = -1; — replace the last (5th) worksheet with edited, because "-1" means "last existing"
         WorksheetNumber = -2; — replace the 4th worksheet with edited
         WorksheetNumber = -3; — replace the 3rd worksheet with edited
         WorksheetNumber = -4; — replace the 2nd worksheet with edited
         WorksheetNumber = -5; — replace the first worksheet with edited
         WorksheetNumber = -6; — replace the first worksheet with edited, because "-6" is greater then 5 and thus is adjusted
         


        <i>WorksheetNumber</i> integer property, if it is not in default state (reserved value '0'), represents a worksheet number, so it starts from 1, not from zero, and its max value is the amount of all existing slides in a presentation. However, if specified value is greater then amount of all slides, GroupDocs.Editor will adjust it to mark the last worksheet. Negative values are also allowed and count worksheets from end. For example, "-1" implies last worksheet in a spreadsheet, "-2" — last but one, etc. Like with positive values, when negative worksheet number exceeds the total count of worksheets in the given spreadsheet, it will be adjusted to the first worksheet. The InsertAsNewWorksheet(getInsertAsNewWorksheet()/setInsertAsNewWorksheet(boolean)) boolean property is tightly coupled with this one.
        Parameters:
        value -
      • setWorksheetProtection

        public final void setWorksheetProtection(WorksheetProtection value)

        Allows to enable a worksheet protection for the output Spreadsheet document. By default is NULL - protection is not applied. Not all formats support a worksheet protection.

        Parameters:
        value -