com.spire.xls
Class Workbook

java.lang.Object
  extended by com.spire.xls.Workbook

public final class Workbook
extends java.lang.Object

Represents the workbook object of excel.


Constructor Summary
Workbook()
          Create a new instance of workbook.
 
Method Summary
 void addPivotTableStyle(PivotTableStyle pts)
           
static boolean bookIsPasswordProtected(java.lang.String fileName)
          Check if the file is password protected.
 void calculateAllValue()
          Caculate all formula for the workbook
 java.lang.Object calculateFormulaValue(java.lang.String text)
          Calculates the string formula
 void changePaletteColor(java.awt.Color color, int index)
          Changes the palette for the spreadsheet in the specified index.
 double columnWidthToPixels(double columnWidth)
          onverts column width in characters into column width in pixels.
 boolean containsFont(ExcelFont font)
          Indicates whether the workbook contains specified font.
 void copyToClipboard()
          Copies whole workbook to the clipboard.
 void copyToClipboard(Worksheet worksheet)
          Copies the selected worksheet to clipboard.
 Worksheet createEmptySheet()
          Create a new worksheet.
 Worksheet createEmptySheet(java.lang.String name)
          Create a new worksheet.
 void createEmptySheets(int sheetCount)
          Create workbook with specified number of worksheets.
 void createEmptySheets(java.lang.String[] sheetNames)
          Create workbook with specified names of worksheets.
 ExcelFont createFont()
          Creates a font object and adds it to the workbook.
 ExcelFont createFont(java.awt.Font font)
          Creates a font object and add it to the workbook.
 PivotStyle createPivotStyle()
           
 void dispose()
           
 CellRange[] findAllBool(boolean boolValue)
          Finds the cell with the input bool.
 CellRange[] findAllDateTime(java.util.Date dateTimeValue)
          Finds the cell with the input datetime.
 CellRange[] findAllNumber(double doubleValue, boolean formulaValue)
          Finds the cell with the input double.
 CellRange[] findAllString(java.lang.String stringValue, boolean formula, boolean formulaValue)
          Finds the cell with the input string.
 CellRange findBool(boolean boolValue)
          Finds the cell with the input bool.
 CellRange findDateTime(java.util.Date dateTimeValue)
          Finds the cell with the input datetime.
 CellRange findNumber(double doubleValue, boolean formulaValue)
          Finds the cell with the input number.
 CellRange findString(java.lang.String stringValue, boolean formula, boolean formulaValue)
          Finds the cell with the input string.
 Worksheet getActiveSheet()
          Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook.
 int getActiveSheetIndex()
          Gets index of the active worksheet.
 AddInFunctionsCollection getAddInFunctions()
          Returns collection of add-in functions.
 boolean getAllow3DRangesInDataValidation()
          Indicates whether to allow usage of 3D ranges in DataValidation list property (MS Excel doesn't allow).
 ExcelCalculationMode getCalculationMode()
          Get calculation mode.
 ChartsCollection getCharts()
          Returns a Sheets collection that represents all the chart sheets in the specified workbook.
 ChartSheet getChartSheetByName(java.lang.String name)
           
 java.util.ArrayList getChartsheets()
           
 java.lang.String getCodeName()
          Name which used by macros to access to workbook items.
 java.awt.Color[] getColors()
          Returns colors in the palette for the workbook.
 ConverterSetting getConverterSetting()
          Get converter setting
 ICustomDocumentProperties getCustomDocumentProperties()
          Returns collection that represents all the custom document properties for the specified workbook.
 java.lang.String[] getCustomFontFilePaths()
          Returns the custom path of font files.
 java.util.Hashtable getCustomFontParsedResult()
          Get result that parse the custom path of font files
 java.util.Hashtable getCustomTableStyles()
           
 DataSorter getDataSorter()
          Gets data sorter to sort the data.
 boolean getDate1904()
          True if the workbook uses the 1904 date system.
 java.nio.charset.Charset getDefaultCharset()
          default Charset = utf-8
 java.lang.String getDefaultFontName()
          Returns the name of the default font.
 double getDefaultFontSize()
          Returns the default font size.
 boolean getDisableMacrosStart()
          Allows users to disable load of macros from document.
 BuiltInDocumentProperties getDocumentProperties()
          Returns a BuiltInDocumentProperties collection that represents all the built-in document properties for the specified workbook.
 java.lang.String getFileName()
          Gets file name.
 MarkerDesigner getMarkerDesigner()
           
 ExcelColors getMatchingColor(java.awt.Color color)
          Find best matching Color in workbook palette.
 ExcelColors getMatchingColor(int r, int g, int b)
          Find best matching Color in workbook palette.
 int getMaxDigitWidth()
           
 INameRanges getNameRanges()
          Gets names collection that represents all the names in the specified workbook
 IXLSRange getOleSize()
          get the size of the visible range of cells when this workbook is displyed as an embedded obect in another document;
 java.lang.String getOpenPassword()
          Returns password to encrypt document.
 boolean getOptimizeImport()
          Indicates whether to optimize Import data.
 java.awt.Color getPaletteColor(ExcelColors color)
          Gets excel color from workbook palette.
 PivotCachesCollection getPivotCaches()
           
 boolean getPrintUsingImageMode()
          get print by using image mode
 boolean getReadOnly()
          Indicates whether the workbook has been opened as Read-only.
 int getSelectedTab()
          Gets tab index of selected.
 boolean getShowTabs()
          Gets a value whether the Workbook tabs are displayed.
 java.util.List<java.util.Map<PageColRow>> getSplitPageInfo()
           
 com.spire.data.table.DataTable getSplitPageTable(Workbook wb)
           
 StylesCollection getStyles()
          Returns a styles collection that represents all the styles in the specified workbook.
 ExcelVersion getVersion()
           
 WorksheetsCollection getWorksheets()
          Returns a sheets collection that represents all the worksheets in the specified workbook.
 boolean hasMacros()
          Indicates whether contains VBA macros.
 void hasMacros(boolean value)
          Sets whether contains VBA macros.
 void initCalcEngine()
          Initilize Calc engine
 boolean isCellProtection()
          Indicates whether cells are protected.
 boolean isRightToLeft()
          Indicates whether worksheet is displayed right to left.
 void isRightToLeft(boolean value)
          Indicates whether worksheet is displayed right to left.
 boolean isSaved()
          Indicates whether workbook changes have been saved.
 boolean isWindowProtection()
          Indicates window is protected.
 void loadFromFile(java.lang.String fileName)
          Loads a file and imports its data.
 void loadFromFile(java.lang.String fileName, boolean preserveMode)
          Loads a file and imports its data.
 void loadFromFile(java.lang.String fileName, ExcelVersion version)
          Loads a file and imports its data.
 void loadFromFile(java.lang.String fileName, java.lang.String separator)
          Loads text files stream with user defined separator.
 void loadFromFile(java.lang.String fileName, java.lang.String separator, int row, int column)
          Loads text files with user defined separator.
 void loadFromFile(java.lang.String fileName, java.lang.String separator, int row, int column, ExcelVersion version)
          Loads text files with user defined separator.
 void loadFromHtml(java.io.InputStream stream)
          Loads a html file and imports its data.
 void loadFromHtml(java.lang.String fileName)
          Loads a html file and imports its data.
 void loadFromMHtml(java.io.InputStream stream)
          Loads a Mhtml file and imports its data.
 void loadFromMHtml(java.lang.String fileName)
          Loads a Mhtml file and imports its data.
 void loadFromStream(java.io.InputStream stream)
          Loads workbook from the stream.
 void loadFromStream(java.io.InputStream stream, boolean loadStyles)
          Load workbook from the stream.
 void loadFromStream(java.io.InputStream stream, ExcelVersion version)
          Load workbook from the stream.
 void loadFromStream(java.io.InputStream stream, java.lang.String separator, int row, int column)
          Loads text files stream with user defined separator.max row 60000.
 void loadFromStream(java.io.InputStream stream, java.lang.String separator, int row, int column, ExcelVersion version)
          Loads text files stream with user defined separator.
 void loadFromXml(java.io.InputStream stream)
          Loads a xml file and imports its data.
 void loadFromXml(java.lang.String fileName)
          Loads a xml file and imports its data.
 void pasteFromClipboard()
          Copies workbook and all its worksheets from the clipboard.
 double pixelsToColumnWidth(double pixels)
          Converts column width in pixels into column width in characters.
 void protect(java.lang.String passwordToOpen)
          Protects file, also protects workbook window and structure.
 void protect(java.lang.String passwordToOpen, boolean bIsProtectWindow, boolean bIsProtectContent)
          Protects file,also indicates whether protects workbook window and structure or not
 void protectWorkbook(boolean bIsProtectWindow, boolean bIsProtectContent, java.lang.String password)
          Sets protection for workbook.
 void replace(java.lang.String oldValue, com.spire.data.table.DataColumn newValues, boolean includeColumnName)
          Replaces cell's value from data column values.
 void replace(java.lang.String oldValue, com.spire.data.table.DataTable newValues, boolean includeColumnName)
          Replaces cell's value from data table values.
 void replace(java.lang.String oldValue, java.util.Date newValue)
          Replaces cell's value by specified value.
 void replace(java.lang.String oldValue, double newValue)
          Replaces cell's value by specified value.
 void replace(java.lang.String oldValue, double[] newValues, boolean isVertical)
          Replaces cell's value from array.
 void replace(java.lang.String oldValue, int[] newValues, boolean isVertical)
          Replaces cell's value from array.
 void replace(java.lang.String oldValue, java.lang.String newValue)
          Replaces cell's value by specified value.
 void replace(java.lang.String oldValue, java.lang.String[] newValues, boolean isVertical)
          Replaces cell's value from array.
 void resetPalette()
          Resets the color palette to the default colors.
 boolean retainHiddenDataToCSV()
          Gets retain hidden data.
 void retainHiddenDataToCSV(boolean value)
          Sets retain hidden data.
 void save()
          Saves changes to the specified workbook
 java.awt.image.BufferedImage[] saveAsImage(float dpiX, float dpiY)
          Save workbook to image.
 java.awt.image.BufferedImage saveAsImage(int sheetIndex, float dpiX, float dpiY)
          Save workbook to image.
 void saveAsTemplate(java.lang.String fileName)
          Save workbook as template to file.
 void saveAsXml(java.io.InputStream stream)
          Save workbook as XML format to stream.
 void saveAsXml(java.lang.String fileName)
          Save workbook to an xml data file.
 java.awt.image.BufferedImage saveChartAsImage(ChartSheet chartSheet)
          Save chart to image.
 java.awt.image.BufferedImage[] saveChartAsImage(Worksheet worksheet)
          Save chart to images.
 java.awt.image.BufferedImage saveChartAsImage(Worksheet worksheet, int chartIndex)
          Saves chart to image.
 void saveToFile(java.lang.String fileName)
          Saves changes to the workbook in a different file
 void saveToFile(java.lang.String fileName, ExcelVersion version)
          Saves changes to the workbook in a different file
 void saveToFile(java.lang.String fileName, FileFormat fileFormat)
          Saves changes to the workbook in a different file
 void saveToFile(java.lang.String fileName, java.lang.String separator)
          Saves changes to the workbook in a different file
 void saveToStream(java.io.OutputStream stream)
          Saves workbook the stream
 void saveToStream(java.io.OutputStream stream, FileFormat fileFormat)
          Saves workbook to stream.
 void saveToStream(java.io.OutputStream stream, java.lang.String separator)
          Save workbook the stream.
 void setActiveSheetIndex(int value)
          Sets index of the active worksheet.
 void setAllow3DRangesInDataValidation(boolean value)
          Indicates whether to allow usage of 3D ranges in DataValidation list property (MS Excel doesn't allow).
 void setCalculationMode(ExcelCalculationMode value)
          Set calculation mode.
 void setCodeName(java.lang.String value)
          Name which used by macros to access to workbook items.
 void setConverterSetting(ConverterSetting value)
           
 void setCustomFontFilePaths(java.lang.String[] value)
          Sets the custom path of font files.
 void setDate1904(boolean value)
          Set if the workbook uses the 1904 date system.
 void setDefaultCharset(java.nio.charset.Charset defaultCharset)
           
 void setDefaultFontName(java.lang.String value)
          Sets the name of the default font.
 void setDefaultFontSize(double value)
          Sets the default font size.
 void setDisableMacrosStart(boolean value)
          Allows users to disable load of macros from document.
 void setMaxDigitWidth(int w)
           
 void setOleSize(int firstRow, int firstColumn, int lastRow, int lastColumn)
          set the size of the visible range of cells when this workbook is displyed as an embedded obect in another document;
 void setOpenPassword(java.lang.String openPassword)
          Sets password to encrypt document.
 void setOptimizeImport(boolean value)
          Indicates whether to optimize Import data.
 void setPrintUsingImageMode(boolean usingImageMode)
          set print by using image mode
 void setSelectedTab(int value)
          Sets tab index of selected.
 void setShowTabs(boolean value)
          Sets a value whether the Workbook tabs are displayed.
 void setVersion(ExcelVersion version)
           
 void setWriteProtectionPassword(java.lang.String password)
          Sets write protection password.
 void unProtect()
          Unprotects file also upprotect workbook window and structure
 void unProtect(java.lang.String bookWindowAndStructurePassword)
          unprotect file also upprotect workbook window and structure
 void unProtectWorkbook(java.lang.String password)
          unprotect workbook window and structure
 

Constructor Detail

Workbook

public Workbook()
Create a new instance of workbook.

Method Detail

getWorksheets

public WorksheetsCollection getWorksheets()
Returns a sheets collection that represents all the worksheets in the specified workbook. Read-only sheets object.

Returns:
Represents the worksheets collection.

getNameRanges

public INameRanges getNameRanges()
Gets names collection that represents all the names in the specified workbook

Returns:

getActiveSheet

public Worksheet getActiveSheet()
Returns an object that represents the active sheet (the sheet on top) in the active workbook or in the specified window or workbook. Returns Nothing if no sheet is active. Read-only.

Returns:

getAllow3DRangesInDataValidation

public boolean getAllow3DRangesInDataValidation()
Indicates whether to allow usage of 3D ranges in DataValidation list property (MS Excel doesn't allow).

Returns:

setAllow3DRangesInDataValidation

public void setAllow3DRangesInDataValidation(boolean value)
Indicates whether to allow usage of 3D ranges in DataValidation list property (MS Excel doesn't allow).

Parameters:
value -

getActiveSheetIndex

public int getActiveSheetIndex()
Gets index of the active worksheet.

Returns:

setActiveSheetIndex

public void setActiveSheetIndex(int value)
Sets index of the active worksheet.

Parameters:
value -

getAddInFunctions

public AddInFunctionsCollection getAddInFunctions()
Returns collection of add-in functions.

Returns:

getCalculationMode

public ExcelCalculationMode getCalculationMode()
Get calculation mode.

Returns:

setCalculationMode

public void setCalculationMode(ExcelCalculationMode value)
Set calculation mode.

Parameters:
value -

getDataSorter

public DataSorter getDataSorter()
Gets data sorter to sort the data.

Returns:

getCodeName

public java.lang.String getCodeName()
Name which used by macros to access to workbook items.

Returns:

setCodeName

public void setCodeName(java.lang.String value)
Name which used by macros to access to workbook items.


getColors

public java.awt.Color[] getColors()
Returns colors in the palette for the workbook. The palette has 56 entries, each represented by an RGB value. Read/write Object.

Returns:

getConverterSetting

public ConverterSetting getConverterSetting()
Get converter setting

Returns:
Convert Setting.

setConverterSetting

public void setConverterSetting(ConverterSetting value)

getDate1904

public boolean getDate1904()
True if the workbook uses the 1904 date system. Read/write Boolean.

Returns:

setDate1904

public void setDate1904(boolean value)
Set if the workbook uses the 1904 date system. Read/write Boolean.

Parameters:
value -

getDefaultFontName

public java.lang.String getDefaultFontName()
Returns the name of the default font.

Returns:

setDefaultFontName

public void setDefaultFontName(java.lang.String value)
Sets the name of the default font.

Parameters:
value -

getDefaultFontSize

public double getDefaultFontSize()
Returns the default font size.

Returns:

setDefaultFontSize

public void setDefaultFontSize(double value)
Sets the default font size.

Parameters:
value -

getCustomFontFilePaths

public java.lang.String[] getCustomFontFilePaths()
Returns the custom path of font files.

Returns:

setCustomFontFilePaths

public void setCustomFontFilePaths(java.lang.String[] value)
Sets the custom path of font files.

Parameters:
value -

getCustomFontParsedResult

public java.util.Hashtable getCustomFontParsedResult()
Get result that parse the custom path of font files


getDisableMacrosStart

public boolean getDisableMacrosStart()
Allows users to disable load of macros from document.

Returns:

setDisableMacrosStart

public void setDisableMacrosStart(boolean value)
Allows users to disable load of macros from document.

Parameters:
value -

getFileName

public java.lang.String getFileName()
Gets file name.

Returns:

hasMacros

public boolean hasMacros()
Indicates whether contains VBA macros.

Returns:

hasMacros

public void hasMacros(boolean value)
Sets whether contains VBA macros.

Parameters:
value -

isCellProtection

public boolean isCellProtection()
Indicates whether cells are protected.

Returns:

isRightToLeft

public boolean isRightToLeft()
Indicates whether worksheet is displayed right to left.


isRightToLeft

public void isRightToLeft(boolean value)
Indicates whether worksheet is displayed right to left.


isSaved

public boolean isSaved()
Indicates whether workbook changes have been saved.

Returns:

isWindowProtection

public boolean isWindowProtection()
Indicates window is protected.

Returns:

getMarkerDesigner

public MarkerDesigner getMarkerDesigner()

getMaxDigitWidth

public int getMaxDigitWidth()

getOpenPassword

public java.lang.String getOpenPassword()
Returns password to encrypt document.

Returns:

setOpenPassword

public void setOpenPassword(java.lang.String openPassword)
Sets password to encrypt document.

Parameters:
openPassword -

getOptimizeImport

public boolean getOptimizeImport()
Indicates whether to optimize Import data. This option will take effect only on Import methods that are available with the worksheet WARNING: Setting this property to True can decrease memory significantly, but will increase the performance of data import .


setOptimizeImport

public void setOptimizeImport(boolean value)
Indicates whether to optimize Import data. This option will take effect only on Import methods that are available with the worksheet WARNING: Setting this property to True can decrease memory significantly,


getPivotCaches

public PivotCachesCollection getPivotCaches()

getReadOnly

public boolean getReadOnly()
Indicates whether the workbook has been opened as Read-only.

Returns:

getSelectedTab

public int getSelectedTab()
Gets tab index of selected.

Returns:

setSelectedTab

public void setSelectedTab(int value)
Sets tab index of selected.

Parameters:
value -

getShowTabs

public boolean getShowTabs()
Gets a value whether the Workbook tabs are displayed.


setShowTabs

public void setShowTabs(boolean value)
Sets a value whether the Workbook tabs are displayed.

Parameters:
value -

getStyles

public StylesCollection getStyles()
Returns a styles collection that represents all the styles in the specified workbook. Read-only.

Returns:

getVersion

public ExcelVersion getVersion()

setVersion

public void setVersion(ExcelVersion version)

getCharts

public ChartsCollection getCharts()
Returns a Sheets collection that represents all the chart sheets in the specified workbook. Read-only.

Returns:

getChartsheets

public java.util.ArrayList getChartsheets()

getCustomDocumentProperties

public ICustomDocumentProperties getCustomDocumentProperties()
Returns collection that represents all the custom document properties for the specified workbook. Read-only.

Returns:

getCustomTableStyles

public java.util.Hashtable getCustomTableStyles()

getDocumentProperties

public BuiltInDocumentProperties getDocumentProperties()
Returns a BuiltInDocumentProperties collection that represents all the built-in document properties for the specified workbook. Read-only.

Returns:

loadFromFile

public void loadFromFile(java.lang.String fileName)
Loads a file and imports its data.

Parameters:
fileName - File name.

loadFromFile

public void loadFromFile(java.lang.String fileName,
                         boolean preserveMode)
Loads a file and imports its data.

Parameters:
fileName - File name
preserveMode - Preserve mode

loadFromFile

public void loadFromFile(java.lang.String fileName,
                         ExcelVersion version)
Loads a file and imports its data.

Parameters:
fileName - File name
version - Excel version

loadFromFile

public void loadFromFile(java.lang.String fileName,
                         java.lang.String separator)
Loads text files stream with user defined separator.

Parameters:
fileName - File name
separator - Delimiter of text file.

loadFromFile

public void loadFromFile(java.lang.String fileName,
                         java.lang.String separator,
                         int row,
                         int column)
Loads text files with user defined separator.

Parameters:
fileName - File name.
separator - Delimiter of text file.
row - Start row.
column - Start column.

loadFromFile

public void loadFromFile(java.lang.String fileName,
                         java.lang.String separator,
                         int row,
                         int column,
                         ExcelVersion version)
Loads text files with user defined separator.

Parameters:
fileName - File name.
separator - Delimiter of text file.
row - Start row.
column - Start column.
version - Workbook version

loadFromStream

public void loadFromStream(java.io.InputStream stream)
Loads workbook from the stream.

Parameters:
stream - Stream contains data.

loadFromStream

public void loadFromStream(java.io.InputStream stream,
                           boolean loadStyles)
Load workbook from the stream.

Parameters:
stream - Stream contains data.
loadStyles - Indicates whether loads styles.

loadFromStream

public void loadFromStream(java.io.InputStream stream,
                           ExcelVersion version)
Load workbook from the stream.

Parameters:
stream - Stream contains data
version - Excel version

loadFromStream

public void loadFromStream(java.io.InputStream stream,
                           java.lang.String separator,
                           int row,
                           int column)
Loads text files stream with user defined separator.max row 60000.

Parameters:
stream - File stream.
separator - Delimiter of text file.
row - Start row.
column - Start column.

loadFromStream

public void loadFromStream(java.io.InputStream stream,
                           java.lang.String separator,
                           int row,
                           int column,
                           ExcelVersion version)
Loads text files stream with user defined separator. Version2007 support 60000+ row

Parameters:
stream - File stream.
separator - Delimiter of text file.
row - Start row.
column - Start column.
version - Excel version.

loadFromXml

public void loadFromXml(java.lang.String fileName)
Loads a xml file and imports its data.

Parameters:
fileName - File name.

loadFromXml

public void loadFromXml(java.io.InputStream stream)
Loads a xml file and imports its data.

Parameters:
stream - Stream contains data.

loadFromHtml

public void loadFromHtml(java.lang.String fileName)
Loads a html file and imports its data.

Parameters:
fileName - File name.

loadFromHtml

public void loadFromHtml(java.io.InputStream stream)
Loads a html file and imports its data.

Parameters:
stream - Stream contains data.

loadFromMHtml

public void loadFromMHtml(java.lang.String fileName)
Loads a Mhtml file and imports its data.

Parameters:
fileName - File name.

loadFromMHtml

public void loadFromMHtml(java.io.InputStream stream)
Loads a Mhtml file and imports its data.

Parameters:
stream - Stream contains data.

saveToFile

public void saveToFile(java.lang.String fileName)
Saves changes to the workbook in a different file

Parameters:
fileName - File name.

saveToFile

public void saveToFile(java.lang.String fileName,
                       FileFormat fileFormat)
Saves changes to the workbook in a different file

Parameters:
fileName - File name
fileFormat - File format

saveToFile

public void saveToFile(java.lang.String fileName,
                       java.lang.String separator)
Saves changes to the workbook in a different file

Parameters:
fileName - File name.
separator -

retainHiddenDataToCSV

public boolean retainHiddenDataToCSV()
Gets retain hidden data.

Returns:

retainHiddenDataToCSV

public void retainHiddenDataToCSV(boolean value)
Sets retain hidden data.

Parameters:
value -

dispose

public void dispose()

saveToFile

public void saveToFile(java.lang.String fileName,
                       ExcelVersion version)
Saves changes to the workbook in a different file

Parameters:
fileName - File name
version - Excel version

addPivotTableStyle

public void addPivotTableStyle(PivotTableStyle pts)

calculateFormulaValue

public java.lang.Object calculateFormulaValue(java.lang.String text)
Calculates the string formula

Parameters:
text -
Returns:

calculateAllValue

public void calculateAllValue()
Caculate all formula for the workbook


changePaletteColor

public void changePaletteColor(java.awt.Color color,
                               int index)
Changes the palette for the spreadsheet in the specified index.

Parameters:
color - Color structure
index - Palette index,Value should be from 0 to 55

columnWidthToPixels

public double columnWidthToPixels(double columnWidth)
onverts column width in characters into column width in pixels.

Parameters:
columnWidth - Column width in characters.
Returns:
Column width in pixels.

containsFont

public boolean containsFont(ExcelFont font)
Indicates whether the workbook contains specified font.

Parameters:
font -
Returns:

copyToClipboard

public void copyToClipboard()
Copies whole workbook to the clipboard.


copyToClipboard

public void copyToClipboard(Worksheet worksheet)
Copies the selected worksheet to clipboard.

Parameters:
worksheet -

createEmptySheet

public Worksheet createEmptySheet()
Create a new worksheet.

Returns:

createEmptySheet

public Worksheet createEmptySheet(java.lang.String name)
Create a new worksheet.

Parameters:
name - Sheet name.
Returns:

createEmptySheets

public void createEmptySheets(int sheetCount)
Create workbook with specified number of worksheets.

Parameters:
sheetCount -

createEmptySheets

public void createEmptySheets(java.lang.String[] sheetNames)
Create workbook with specified names of worksheets.

Parameters:
sheetNames -

createFont

public ExcelFont createFont()
Creates a font object and adds it to the workbook.

Returns:

createFont

public ExcelFont createFont(java.awt.Font font)
Creates a font object and add it to the workbook.

Parameters:
font - Font to add
Returns:

createPivotStyle

public PivotStyle createPivotStyle()

findAllBool

public CellRange[] findAllBool(boolean boolValue)
Finds the cell with the input bool.

Parameters:
boolValue - Bool value to search for
Returns:
Found ranges

findAllNumber

public CellRange[] findAllNumber(double doubleValue,
                                 boolean formulaValue)
Finds the cell with the input double.

Parameters:
doubleValue - Double value to search for.
formulaValue - Indicates whether includes formula value to search for.
Returns:

findAllString

public CellRange[] findAllString(java.lang.String stringValue,
                                 boolean formula,
                                 boolean formulaValue)
Finds the cell with the input string.

Parameters:
stringValue - String value to search for
formula - Indicates whether includes formula to search for.
formulaValue - Indicates whether includes formula value to search for.
Returns:

findAllDateTime

public CellRange[] findAllDateTime(java.util.Date dateTimeValue)
Finds the cell with the input datetime.

Parameters:
dateTimeValue -
Returns:

findBool

public CellRange findBool(boolean boolValue)
Finds the cell with the input bool.

Parameters:
boolValue - Bool value to search for.
Returns:
Found range.

findNumber

public CellRange findNumber(double doubleValue,
                            boolean formulaValue)
Finds the cell with the input number.

Parameters:
doubleValue - Double value to search for.
formulaValue - Indicates whether includes formula value to search for.
Returns:
Found range.

findString

public CellRange findString(java.lang.String stringValue,
                            boolean formula,
                            boolean formulaValue)
Finds the cell with the input string.

Parameters:
stringValue - String value to search for.
formula - Indicates whether includes formula to search for.
formulaValue - Indicates whether includes formula value to search for.
Returns:
Found range.

findDateTime

public CellRange findDateTime(java.util.Date dateTimeValue)
Finds the cell with the input datetime.

Parameters:
dateTimeValue - Datetime value to search for.
Returns:
Found range.

getMatchingColor

public ExcelColors getMatchingColor(java.awt.Color color)
Find best matching Color in workbook palette.

Parameters:
color - Color to search for.
Returns:
Workbook palette color.

getMatchingColor

public ExcelColors getMatchingColor(int r,
                                    int g,
                                    int b)
Find best matching Color in workbook palette.

Parameters:
r - Red color.
g - Green color.
b - Blue color.
Returns:
Workbook palette color.

getPaletteColor

public java.awt.Color getPaletteColor(ExcelColors color)
Gets excel color from workbook palette.

Parameters:
color - Index from palette array.
Returns:
RGB Color.

getSplitPageInfo

public java.util.List<java.util.Map<PageColRow>> getSplitPageInfo()

getSplitPageTable

public com.spire.data.table.DataTable getSplitPageTable(Workbook wb)

initCalcEngine

public void initCalcEngine()
Initilize Calc engine


bookIsPasswordProtected

public static boolean bookIsPasswordProtected(java.lang.String fileName)
Check if the file is password protected.

Parameters:
fileName -
Returns:

pasteFromClipboard

public void pasteFromClipboard()
Copies workbook and all its worksheets from the clipboard.


pixelsToColumnWidth

public double pixelsToColumnWidth(double pixels)
Converts column width in pixels into column width in characters.

Parameters:
pixels - Column width in pixels.
Returns:
Column width in characters.

protect

public void protect(java.lang.String passwordToOpen)
Protects file, also protects workbook window and structure.

Parameters:
passwordToOpen - password to open file.

protect

public void protect(java.lang.String passwordToOpen,
                    boolean bIsProtectWindow,
                    boolean bIsProtectContent)
Protects file,also indicates whether protects workbook window and structure or not

Parameters:
passwordToOpen - password to open file.
bIsProtectWindow - Indicates if protect workbook window.
bIsProtectContent - Indicates if protect workbook content.

protectWorkbook

public void protectWorkbook(boolean bIsProtectWindow,
                            boolean bIsProtectContent,
                            java.lang.String password)
Sets protection for workbook.

Parameters:
bIsProtectWindow - Indicates if protect workbook window.
bIsProtectContent - Indicates if protect workbook content.
password - password

replace

public void replace(java.lang.String oldValue,
                    com.spire.data.table.DataColumn newValues,
                    boolean includeColumnName)
Replaces cell's value from data column values.

Parameters:
oldValue - Value to replace.
newValues - New data.
includeColumnName - Indicates whether includes column name.

replace

public void replace(java.lang.String oldValue,
                    com.spire.data.table.DataTable newValues,
                    boolean includeColumnName)
Replaces cell's value from data table values.

Parameters:
oldValue - Value to replace.
newValues - New data.
includeColumnName - Indicates whether includes column name.

replace

public void replace(java.lang.String oldValue,
                    java.util.Date newValue)
Replaces cell's value by specified value.

Parameters:
oldValue - Value to replace.
newValue - New value

replace

public void replace(java.lang.String oldValue,
                    double newValue)
Replaces cell's value by specified value.

Parameters:
oldValue - Value to replace.
newValue - New value.

replace

public void replace(java.lang.String oldValue,
                    double[] newValues,
                    boolean isVertical)
Replaces cell's value from array.

Parameters:
oldValue - Value to replace.
newValues - New values.
isVertical - Indicates whether new values should be inserted vertically.

replace

public void replace(java.lang.String oldValue,
                    int[] newValues,
                    boolean isVertical)
Replaces cell's value from array.

Parameters:
oldValue - Value to replace.
newValues - New values.
isVertical - Indicates whether new values should be inserted vertically.

replace

public void replace(java.lang.String oldValue,
                    java.lang.String newValue)
Replaces cell's value by specified value.

Parameters:
oldValue - Value to replace.
newValue - New value

replace

public void replace(java.lang.String oldValue,
                    java.lang.String[] newValues,
                    boolean isVertical)
Replaces cell's value from array.

Parameters:
oldValue - Value to replace.
newValues - New values.
isVertical - Indicates whether new values should be inserted vertically.

resetPalette

public void resetPalette()
Resets the color palette to the default colors.


save

public void save()
Saves changes to the specified workbook


saveAsImage

public java.awt.image.BufferedImage[] saveAsImage(float dpiX,
                                                  float dpiY)
Save workbook to image.

Parameters:
dpiX - Dpi X
dpiY - Dpi Y
Returns:

saveAsImage

public java.awt.image.BufferedImage saveAsImage(int sheetIndex,
                                                float dpiX,
                                                float dpiY)
Save workbook to image.

Parameters:
sheetIndex - sheet Index
dpiX - Dpi X
dpiY - Dpi Y
Returns:

saveAsXml

public void saveAsXml(java.lang.String fileName)
Save workbook to an xml data file.

Parameters:
fileName - XML file name.

saveAsXml

public void saveAsXml(java.io.InputStream stream)
Save workbook as XML format to stream.

Parameters:
stream - Stream object.

saveChartAsImage

public java.awt.image.BufferedImage saveChartAsImage(ChartSheet chartSheet)
Save chart to image.

Parameters:
chartSheet - chart sheet
Returns:

saveChartAsImage

public java.awt.image.BufferedImage[] saveChartAsImage(Worksheet worksheet)
Save chart to images.

Parameters:
worksheet - worksheet instance
Returns:
Worksheet chart to images.

saveChartAsImage

public java.awt.image.BufferedImage saveChartAsImage(Worksheet worksheet,
                                                     int chartIndex)
Saves chart to image.

Parameters:
worksheet - Work sheet
chartIndex - Chart index
Returns:

saveAsTemplate

public void saveAsTemplate(java.lang.String fileName)
Save workbook as template to file.

Parameters:
fileName -

saveToStream

public void saveToStream(java.io.OutputStream stream)
Saves workbook the stream

Parameters:
stream - Stream object

saveToStream

public void saveToStream(java.io.OutputStream stream,
                         FileFormat fileFormat)
Saves workbook to stream.

Parameters:
stream -
fileFormat -

saveToStream

public void saveToStream(java.io.OutputStream stream,
                         java.lang.String separator)
Save workbook the stream.

Parameters:
stream - Stream object.
separator - Separator

setMaxDigitWidth

public void setMaxDigitWidth(int w)

setOleSize

public void setOleSize(int firstRow,
                       int firstColumn,
                       int lastRow,
                       int lastColumn)
set the size of the visible range of cells when this workbook is displyed as an embedded obect in another document;

Parameters:
firstRow - the visible range's first row index
firstColumn - the visible range's first column index
lastRow - the visible range's last row index
lastColumn - the visible range's last column index

setWriteProtectionPassword

public void setWriteProtectionPassword(java.lang.String password)
Sets write protection password.

Parameters:
password - Password to set

unProtect

public void unProtect()
Unprotects file also upprotect workbook window and structure


unProtect

public void unProtect(java.lang.String bookWindowAndStructurePassword)
unprotect file also upprotect workbook window and structure

Parameters:
bookWindowAndStructurePassword - password for protect workbook window and structure

unProtectWorkbook

public void unProtectWorkbook(java.lang.String password)
unprotect workbook window and structure

Parameters:
password - password

getChartSheetByName

public ChartSheet getChartSheetByName(java.lang.String name)

getOleSize

public IXLSRange getOleSize()
get the size of the visible range of cells when this workbook is displyed as an embedded obect in another document;

Returns:
if there does not set the size ,return null

getPrintUsingImageMode

public boolean getPrintUsingImageMode()
get print by using image mode


setPrintUsingImageMode

public void setPrintUsingImageMode(boolean usingImageMode)
set print by using image mode


getDefaultCharset

public java.nio.charset.Charset getDefaultCharset()
default Charset = utf-8


setDefaultCharset

public void setDefaultCharset(java.nio.charset.Charset defaultCharset)
Parameters:
defaultCharset - charset