DocxSaveOptions

Inheritance: java.lang.Object, com.aspose.cells.SaveOptions, com.aspose.cells.PaginatedSaveOptions

public class DocxSaveOptions extends PaginatedSaveOptions

Represents options of saving .docx file.

Constructors

ConstructorDescription
DocxSaveOptions()Represents options of saving .docx file.
DocxSaveOptions(boolean saveAsImage)Represents options of saving .docx file.

Methods

MethodDescription
equals(Object arg0)
getAllColumnsInOnePagePerSheet()If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result.
getCachedFileFolder()The cached file folder is used to store some large data.
getCheckFontCompatibility()Indicates whether to check font compatibility for every character in text.
getCheckWorkbookDefaultFont()When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image.
getClass()
getClearData()Make the workbook empty after saving the file.
getCreateDirectory()If true and the directory does not exist, the directory will be automatically created before saving the file.
getDefaultEditLanguage()Gets default edit language.
getDefaultFont()When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image.
getDrawObjectEventHandler()Implements this interface to get DrawObject and Bound when rendering.
getEmfRenderSetting()Setting for rendering Emf metafile.
getEncryptDocumentProperties()Indicates whether encrypt document properties when saving as .xls file.
getGridlineType()Gets gridline type.
getIgnoreError()Indicates if you need to hide the error while rendering.
getMergeAreas()Indicates whether merge the areas of conditional formatting and validation before saving the file.
getOnePagePerSheet()If OnePagePerSheet is true , all content of one sheet will output to only one page in result.
getOutputBlankPageWhenNothingToPrint()Indicates whether to output a blank page when there is nothing to print.
getPageCount()Gets the number of pages to save.
getPageIndex()Gets the 0-based index of the first page to save.
getPageSavingCallback()Control/Indicate progress of page saving process.
getPrintingPageType()Indicates which pages will not be printed.
getRefreshChartCache()Indicates whether refreshing chart cache data
getSaveFormat()Gets the save file format.
getSheetSet()Gets the sheets to render.
getSortExternalNames()Indicates whether sorting external defined names before saving file.
getSortNames()Indicates whether sorting defined names before saving file.
getTextCrossType()Gets displaying text type when the text width is larger than cell width.
getUpdateSmartArt()Indicates whether updating smart art setting.
getValidateMergedAreas()Indicates whether validate merged cells before saving the file.
getWarningCallback()Gets warning callback.
hashCode()
isFontSubstitutionCharGranularity()Indicates whether to only substitute the font of character when the cell font is not compatibility for it.
notify()
notifyAll()
setAllColumnsInOnePagePerSheet(boolean value)If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result.
setCachedFileFolder(String value)The cached file folder is used to store some large data.
setCheckFontCompatibility(boolean value)Indicates whether to check font compatibility for every character in text.
setCheckWorkbookDefaultFont(boolean value)When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image.
setClearData(boolean value)Make the workbook empty after saving the file.
setCreateDirectory(boolean value)If true and the directory does not exist, the directory will be automatically created before saving the file.
setDefaultEditLanguage(int value)Sets default edit language.
setDefaultFont(String value)When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image.
setDrawObjectEventHandler(DrawObjectEventHandler value)Implements this interface to get DrawObject and Bound when rendering.
setEmfRenderSetting(int value)Setting for rendering Emf metafile.
setEncryptDocumentProperties(boolean value)Indicates whether encrypt document properties when saving as .xls file.
setFontSubstitutionCharGranularity(boolean value)Indicates whether to only substitute the font of character when the cell font is not compatibility for it.
setGridlineType(int value)Sets gridline type.
setIgnoreError(boolean value)Indicates if you need to hide the error while rendering.
setMergeAreas(boolean value)Indicates whether merge the areas of conditional formatting and validation before saving the file.
setOnePagePerSheet(boolean value)If OnePagePerSheet is true , all content of one sheet will output to only one page in result.
setOutputBlankPageWhenNothingToPrint(boolean value)Indicates whether to output a blank page when there is nothing to print.
setPageCount(int value)Sets the number of pages to save.
setPageIndex(int value)Sets the 0-based index of the first page to save.
setPageSavingCallback(IPageSavingCallback value)Control/Indicate progress of page saving process.
setPrintingPageType(int value)Indicates which pages will not be printed.
setRefreshChartCache(boolean value)Indicates whether refreshing chart cache data
setSheetSet(SheetSet value)Sets the sheets to render.
setSortExternalNames(boolean value)Indicates whether sorting external defined names before saving file.
setSortNames(boolean value)Indicates whether sorting defined names before saving file.
setTextCrossType(int value)Sets displaying text type when the text width is larger than cell width.
setUpdateSmartArt(boolean value)Indicates whether updating smart art setting.
setValidateMergedAreas(boolean value)Indicates whether validate merged cells before saving the file.
setWarningCallback(IWarningCallback value)Sets warning callback.
toString()
wait()
wait(long arg0)
wait(long arg0, int arg1)

DocxSaveOptions()

public DocxSaveOptions()

Represents options of saving .docx file.

DocxSaveOptions(boolean saveAsImage)

public DocxSaveOptions(boolean saveAsImage)

Represents options of saving .docx file.

Parameters:

ParameterTypeDescription
saveAsImagebooleanIf True, the workbook will be converted into some pictures of .docx file. If False, the workbook will be converted into some tables of .docx file.

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

ParameterTypeDescription
arg0java.lang.Object

Returns: boolean

getAllColumnsInOnePagePerSheet()

public boolean getAllColumnsInOnePagePerSheet()

If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result. The width of paper size of pagesetup will be ignored, and the other settings of pagesetup will still take effect.

Returns: boolean

getCachedFileFolder()

public String getCachedFileFolder()

The cached file folder is used to store some large data.

Returns: java.lang.String

getCheckFontCompatibility()

public boolean getCheckFontCompatibility()

Indicates whether to check font compatibility for every character in text.

Remarks

The default value is true. Disable this property may give better performance. But when the default or specified font of text/character cannot be used to render it, unreadable characters(such as block) maybe occur in the generated pdf. For such situation user should keep this property as true so that alternative font can be searched and used to render the text instead;

Returns: boolean

getCheckWorkbookDefaultFont()

public boolean getCheckWorkbookDefaultFont()

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set this to true to try to use workbook’s default font to show these characters first.

Remarks

Default is true.

Returns: boolean

getClass()

public final native Class<?> getClass()

Returns: java.lang.Class

getClearData()

public boolean getClearData()

Make the workbook empty after saving the file.

Returns: boolean

getCreateDirectory()

public boolean getCreateDirectory()

If true and the directory does not exist, the directory will be automatically created before saving the file.

Remarks

The default value is false.

Returns: boolean

getDefaultEditLanguage()

public int getDefaultEditLanguage()

Gets default edit language.

See DefaultEditLanguage.

Remarks

It may display/render different layouts for text paragraph when different edit languages is set. Default is DefaultEditLanguage.AUTO.

Returns: int

getDefaultFont()

public String getDefaultFont()

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set the DefaultFont such as MingLiu or MS Gothic to show these characters. If this property is not set, Aspose.Cells will use system default font to show these unicode characters.

Returns: java.lang.String

getDrawObjectEventHandler()

public DrawObjectEventHandler getDrawObjectEventHandler()

Implements this interface to get DrawObject and Bound when rendering.

Returns: DrawObjectEventHandler

getEmfRenderSetting()

public int getEmfRenderSetting()

Setting for rendering Emf metafile.

See EmfRenderSetting.

Remarks

EMF metafiles identified as “EMF+ Dual” can contain both EMF+ records and EMF records. Either type of record can be used to render the image, only EMF+ records, or only EMF records. When EmfRenderSetting.EMF_PLUS_PREFER is set, then EMF+ records will be parsed while rendering to page, otherwise only EMF records will be parsed. Default value is EmfRenderSetting.EMF_ONLY.

Returns: int

getEncryptDocumentProperties()

public boolean getEncryptDocumentProperties()

Indicates whether encrypt document properties when saving as .xls file. The default value is true.

Remarks

Only for .xls,xlsx,xlsb and xlsm file.

Returns: boolean

getGridlineType()

public int getGridlineType()

Gets gridline type.

See GridlineType.

Remarks

Default is Dotted type.

Returns: int

getIgnoreError()

public boolean getIgnoreError()

Indicates if you need to hide the error while rendering. The error can be error in shape, image, chart rendering, etc.

Returns: boolean

getMergeAreas()

public boolean getMergeAreas()

Indicates whether merge the areas of conditional formatting and validation before saving the file.

Remarks

The default value is false.

Returns: boolean

getOnePagePerSheet()

public boolean getOnePagePerSheet()

If OnePagePerSheet is true , all content of one sheet will output to only one page in result. The paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.

Returns: boolean

getOutputBlankPageWhenNothingToPrint()

public boolean getOutputBlankPageWhenNothingToPrint()

Indicates whether to output a blank page when there is nothing to print.

Remarks

Default is true.

Returns: boolean

getPageCount()

public int getPageCount()

Gets the number of pages to save.

Remarks

Default is System.Int32.MaxValue which means all pages will be rendered..

Example

The following example shows how to render a range of pages (3 and 4) in a Microsoft Excel file to PDF.

         //Open an Excel file
         Workbook wb = new Workbook("Book1.xlsx");
 
         PdfSaveOptions options = new PdfSaveOptions();
 
         //Print only Page 3 and Page 4 in the output PDF
         //Starting page index (0-based index)
         options.setPageIndex(3);
         //Number of pages to be printed
         options.setPageCount(2);
 
         //Save the PDF file
         wb.save("output.pdf", options);

Returns: int

getPageIndex()

public int getPageIndex()

Gets the 0-based index of the first page to save.

Remarks

Default is 0.

Example

The following example shows how to render a range of pages (3 and 4) in a Microsoft Excel file to PDF.

         //Open an Excel file
         Workbook wb = new Workbook("Book1.xlsx");
 
         PdfSaveOptions options = new PdfSaveOptions();
 
         //Print only Page 3 and Page 4 in the output PDF
         //Starting page index (0-based index)
         options.setPageIndex(3);
         //Number of pages to be printed
         options.setPageCount(2);
 
         //Save the PDF file
         wb.save("output.pdf", options);

Returns: int

getPageSavingCallback()

public IPageSavingCallback getPageSavingCallback()

Control/Indicate progress of page saving process.

Returns: IPageSavingCallback

getPrintingPageType()

public int getPrintingPageType()

Indicates which pages will not be printed.

See PrintingPageType.

Remarks

If content in the sheet is sparse, there will be some pages are totally blank in the output pdf file. If you don’t want these blank pages, you can use this option to omit them.

Example

The following code omits blank pages or pages which only contains some style content like cell background, borders.

         Workbook wb = new Workbook("Book1.xlsx");
 
         PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
 
         //ignore blank pages
         pdfSaveOptions.setPrintingPageType(PrintingPageType.IGNORE_BLANK);
 
         wb.save("output_ignore_blank_page.pdf", pdfSaveOptions);
 
 
         //ignore blank pages and pages which only contains some style content like cell background
         pdfSaveOptions.setPrintingPageType(PrintingPageType.IGNORE_STYLE);
 
         wb.save("output_ignore_blank_and_style_page.pdf", pdfSaveOptions);

Returns: int

getRefreshChartCache()

public boolean getRefreshChartCache()

Indicates whether refreshing chart cache data

Returns: boolean

getSaveFormat()

public int getSaveFormat()

Gets the save file format.

See SaveFormat.

Returns: int

getSheetSet()

public SheetSet getSheetSet()

Gets the sheets to render. Default is all visible sheets in the workbook: SheetSet.getVisible().

Example

The following code only renders active sheet to pdf.

         Workbook workbook = new Workbook("Book1.xlsx");
 
         int activeSheetIndex = workbook.getWorksheets().getActiveSheetIndex();
 
         PdfSaveOptions pdfSaveOptions = new PdfSaveOptions();
         //set active sheet index to sheet set.
         pdfSaveOptions.setSheetSet(new SheetSet(new int[] { activeSheetIndex }));
         workbook.save("output.pdf", pdfSaveOptions);

Returns: SheetSet

getSortExternalNames()

public boolean getSortExternalNames()

Indicates whether sorting external defined names before saving file.

Returns: boolean

getSortNames()

public boolean getSortNames()

Indicates whether sorting defined names before saving file.

Returns: boolean

getTextCrossType()

public int getTextCrossType()

Gets displaying text type when the text width is larger than cell width.

See TextCrossType.

Returns: int

getUpdateSmartArt()

public boolean getUpdateSmartArt()

Indicates whether updating smart art setting. The default value is false.

Remarks

Only effects after calling Shape.GetResultOfSmartArt() method and the cached shapes exist in the template file.

Returns: boolean

getValidateMergedAreas()

public boolean getValidateMergedAreas()

Indicates whether validate merged cells before saving the file.

Remarks

The default value is false.

Returns: boolean

getWarningCallback()

public IWarningCallback getWarningCallback()

Gets warning callback.

Returns: IWarningCallback

hashCode()

public native int hashCode()

Returns: int

isFontSubstitutionCharGranularity()

public boolean isFontSubstitutionCharGranularity()

Indicates whether to only substitute the font of character when the cell font is not compatibility for it.

Remarks

Default is false. We will try default font of Workbook and PdfSaveOption/system for cell font first.

Returns: boolean

notify()

public final native void notify()

notifyAll()

public final native void notifyAll()

setAllColumnsInOnePagePerSheet(boolean value)

public void setAllColumnsInOnePagePerSheet(boolean value)

If AllColumnsInOnePagePerSheet is true , all column content of one sheet will output to only one page in result. The width of paper size of pagesetup will be ignored, and the other settings of pagesetup will still take effect.

Parameters:

ParameterTypeDescription
valueboolean

setCachedFileFolder(String value)

public void setCachedFileFolder(String value)

The cached file folder is used to store some large data.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setCheckFontCompatibility(boolean value)

public void setCheckFontCompatibility(boolean value)

Indicates whether to check font compatibility for every character in text.

Remarks

The default value is true. Disable this property may give better performance. But when the default or specified font of text/character cannot be used to render it, unreadable characters(such as block) maybe occur in the generated pdf. For such situation user should keep this property as true so that alternative font can be searched and used to render the text instead;

Parameters:

ParameterTypeDescription
valueboolean

setCheckWorkbookDefaultFont(boolean value)

public void setCheckWorkbookDefaultFont(boolean value)

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set this to true to try to use workbook’s default font to show these characters first.

Remarks

Default is true.

Parameters:

ParameterTypeDescription
valueboolean

setClearData(boolean value)

public void setClearData(boolean value)

Make the workbook empty after saving the file.

Parameters:

ParameterTypeDescription
valueboolean

setCreateDirectory(boolean value)

public void setCreateDirectory(boolean value)

If true and the directory does not exist, the directory will be automatically created before saving the file.

Remarks

The default value is false.

Parameters:

ParameterTypeDescription
valueboolean

setDefaultEditLanguage(int value)

public void setDefaultEditLanguage(int value)

Sets default edit language.

See DefaultEditLanguage.

Remarks

It may display/render different layouts for text paragraph when different edit languages is set. Default is DefaultEditLanguage.AUTO.

Parameters:

ParameterTypeDescription
valueint

setDefaultFont(String value)

public void setDefaultFont(String value)

When characters in the Excel are Unicode and not be set with correct font in cell style, They may appear as block in pdf,image. Set the DefaultFont such as MingLiu or MS Gothic to show these characters. If this property is not set, Aspose.Cells will use system default font to show these unicode characters.

Parameters:

ParameterTypeDescription
valuejava.lang.String

setDrawObjectEventHandler(DrawObjectEventHandler value)

public void setDrawObjectEventHandler(DrawObjectEventHandler value)

Implements this interface to get DrawObject and Bound when rendering.

Parameters:

ParameterTypeDescription
valueDrawObjectEventHandler

setEmfRenderSetting(int value)

public void setEmfRenderSetting(int value)

Setting for rendering Emf metafile.

See EmfRenderSetting.

Remarks

EMF metafiles identified as “EMF+ Dual” can contain both EMF+ records and EMF records. Either type of record can be used to render the image, only EMF+ records, or only EMF records. When EmfRenderSetting.EMF_PLUS_PREFER is set, then EMF+ records will be parsed while rendering to page, otherwise only EMF records will be parsed. Default value is EmfRenderSetting.EMF_ONLY.

Parameters:

ParameterTypeDescription
valueint

setEncryptDocumentProperties(boolean value)

public void setEncryptDocumentProperties(boolean value)

Indicates whether encrypt document properties when saving as .xls file. The default value is true.

Remarks

Only for .xls,xlsx,xlsb and xlsm file.

Parameters:

ParameterTypeDescription
valueboolean

setFontSubstitutionCharGranularity(boolean value)

public void setFontSubstitutionCharGranularity(boolean value)

Indicates whether to only substitute the font of character when the cell font is not compatibility for it.

Remarks

Default is false. We will try default font of Workbook and PdfSaveOption/system for cell font first.

Parameters:

ParameterTypeDescription
valueboolean

setGridlineType(int value)

public void setGridlineType(int value)

Sets gridline type.

See GridlineType.

Remarks

Default is Dotted type.

Parameters:

ParameterTypeDescription
valueint

setIgnoreError(boolean value)

public void setIgnoreError(boolean value)

Indicates if you need to hide the error while rendering. The error can be error in shape, image, chart rendering, etc.

Parameters:

ParameterTypeDescription
valueboolean

setMergeAreas(boolean value)

public void setMergeAreas(boolean value)

Indicates whether merge the areas of conditional formatting and validation before saving the file.

Remarks

The default value is false.

Parameters:

ParameterTypeDescription
valueboolean

setOnePagePerSheet(boolean value)

public void setOnePagePerSheet(boolean value)

If OnePagePerSheet is true , all content of one sheet will output to only one page in result. The paper size of pagesetup will be invalid, and the other settings of pagesetup will still take effect.

Parameters:

ParameterTypeDescription
valueboolean

setOutputBlankPageWhenNothingToPrint(boolean value)

public void setOutputBlankPageWhenNothingToPrint(boolean value)

Indicates whether to output a blank page when there is nothing to print.

Remarks

Default is true.

Parameters:

ParameterTypeDescription
valueboolean

setPageCount(int value)

public void setPageCount(int value)

Sets the number of pages to save.

Remarks

Default is System.Int32.MaxValue which means all pages will be rendered..

Parameters:

ParameterTypeDescription
valueint

setPageIndex(int value)

public void setPageIndex(int value)

Sets the 0-based index of the first page to save.

Remarks

Default is 0.

Parameters:

ParameterTypeDescription
valueint

setPageSavingCallback(IPageSavingCallback value)

public void setPageSavingCallback(IPageSavingCallback value)

Control/Indicate progress of page saving process.

Parameters:

ParameterTypeDescription
valueIPageSavingCallback

setPrintingPageType(int value)

public void setPrintingPageType(int value)

Indicates which pages will not be printed.

See PrintingPageType.

Remarks

If content in the sheet is sparse, there will be some pages are totally blank in the output pdf file. If you don’t want these blank pages, you can use this option to omit them.

Parameters:

ParameterTypeDescription
valueint

setRefreshChartCache(boolean value)

public void setRefreshChartCache(boolean value)

Indicates whether refreshing chart cache data

Parameters:

ParameterTypeDescription
valueboolean

setSheetSet(SheetSet value)

public void setSheetSet(SheetSet value)

Sets the sheets to render. Default is all visible sheets in the workbook: SheetSet.getVisible().

Parameters:

ParameterTypeDescription
valueSheetSet

setSortExternalNames(boolean value)

public void setSortExternalNames(boolean value)

Indicates whether sorting external defined names before saving file.

Parameters:

ParameterTypeDescription
valueboolean

setSortNames(boolean value)

public void setSortNames(boolean value)

Indicates whether sorting defined names before saving file.

Parameters:

ParameterTypeDescription
valueboolean

setTextCrossType(int value)

public void setTextCrossType(int value)

Sets displaying text type when the text width is larger than cell width.

See TextCrossType.

Parameters:

ParameterTypeDescription
valueint

setUpdateSmartArt(boolean value)

public void setUpdateSmartArt(boolean value)

Indicates whether updating smart art setting. The default value is false.

Remarks

Only effects after calling Shape.GetResultOfSmartArt() method and the cached shapes exist in the template file.

Parameters:

ParameterTypeDescription
valueboolean

setValidateMergedAreas(boolean value)

public void setValidateMergedAreas(boolean value)

Indicates whether validate merged cells before saving the file.

Remarks

The default value is false.

Parameters:

ParameterTypeDescription
valueboolean

setWarningCallback(IWarningCallback value)

public void setWarningCallback(IWarningCallback value)

Sets warning callback.

Parameters:

ParameterTypeDescription
valueIWarningCallback

toString()

public String toString()

Returns: java.lang.String

wait()

public final void wait()

wait(long arg0)

public final native void wait(long arg0)

Parameters:

ParameterTypeDescription
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

ParameterTypeDescription
arg0long
arg1int