com.aspose.cells
Classes 
AboveAverage
AbstractCalculationEngine
AbstractCalculationMonitor
AbstractGlobalizationSettings
AbstractInterruptMonitor
AbstractTextLoadOptions
ActiveXControl
ActiveXControlBase
ArcShape
Area
AutoFilter
AutoFitterOptions
AutomaticFill
AutoNumberedBulletValue
Axis
AxisBins
BaseShapeGuide
Bevel
Border
BorderCollection
BuiltInDocumentPropertyCollection
Bullet
BulletValue
Button
CalculationCell
CalculationData
CalculationOptions
Cell
CellArea
Cells
CellsColor
CellsDataTableFactory
CellsDrawing
CellsException
CellsFactory
CellsHelper
CellWatch
CellWatchCollection
CharacterBulletValue
Chart
ChartArea
ChartCollection
ChartDataTable
ChartFrame
ChartGlobalizationSettings
ChartPoint
ChartPointCollection
ChartShape
ChartTextFrame
CheckBox
CheckBoxActiveXControl
CheckBoxCollection
CollectionBase
Color
ColorFilter
ColorHelper
ColorScale
Column
ColumnCollection
ComboBox
ComboBoxActiveXControl
CommandButtonActiveXControl
Comment
CommentCollection
CommentShape
ConditionalFormattingCollection
ConditionalFormattingIcon
ConditionalFormattingIconCollection
ConditionalFormattingResult
ConditionalFormattingValue
ConditionalFormattingValueCollection
ConnectionParameter
ConnectionParameterCollection
ContentTypeProperty
ContentTypePropertyCollection
CopyOptions
CustomDocumentPropertyCollection
CustomFilter
CustomFilterCollection
CustomGeometry
CustomImplementationFactory
CustomProperty
CustomPropertyCollection
CustomXmlPart
CustomXmlPartCollection
CustomXmlShape
DataBar
DataBarBorder
DataLabels
DataSorter
DataSorterKey
DataSorterKeyCollection
DateTime
DateTimeGroupItem
DBConnection
DefaultStyleSettings
DeleteOptions
DialogBox
DifSaveOptions
DigitalSignature
DigitalSignatureCollection
DisplayUnitLabel
DocumentProperty
DocumentPropertyCollection
DocxSaveOptions
DrawObject
DrawObjectEventHandler
DropBars
DxfCollection
DynamicFilter
Encoding
ErrorBar
ErrorCheckOption
ErrorCheckOptionCollection
ExportObjectEvent
ExportRangeToJsonOptions
ExportTableOptions
ExternalConnection
ExternalConnectionCollection
ExternalLink
ExternalLinkCollection
FileFontSource
FileFormatInfo
FileFormatUtil
Fill
FillFormat
FilterColumn
FilterColumnCollection
FindOptions
Floor
FolderFontSource
Font
FontConfigs
FontSetting
FontSettingCollection
FontSourceBase
Format3D
FormatCondition
FormatConditionCollection
FormulaParseOptions
FormulaSettings
Geometry
GlobalizationSettings
GlowEffect
GradientFill
GradientStop
GradientStopCollection
GroupBox
GroupFill
GroupShape
HeaderFooterCommand
HorizontalPageBreak
HorizontalPageBreakCollection
HtmlLoadOptions
HtmlSaveOptions
Hyperlink
HyperlinkCollection
IconFilter
IconSet
ImageActiveXControl
ImageFormat
ImageOrPrintOptions
ImageSaveOptions
ImportTableOptions
IndividualFontConfigs
InsertOptions
InterruptMonitor
JsonLayoutOptions
JsonLoadOptions
JsonSaveOptions
JsonUtility
Label
LabelActiveXControl
Legend
LegendEntry
LegendEntryCollection
License
Line
LineFormat
LineShape
ListBox
ListBoxActiveXControl
ListColumn
ListColumnCollection
ListObject
ListObjectCollection
LoadFilter
LoadOptions
MarkdownSaveOptions
Marker
MemoryFontSource
MetadataOptions
Metered
MsoFillFormat
MsoFillFormatHelper
MsoFormatPicture
MsoLineFormat
MsoLineFormatHelper
MsoTextFrame
MultipleFilterCollection
Name
NameCollection
NegativeBarFormat
NoneBulletValue
NoneFill
OdsCellField
OdsCellFieldCollection
OdsLoadOptions
OdsPageBackground
OdsSaveOptions
OleObject
OleObjectCollection
OoxmlSaveOptions
Outline
Oval
PageEndSavingArgs
PageSavingArgs
PageSetup
PageStartSavingArgs
PaneCollection
PasteOptions
PatternFill
PdfBookmarkEntry
PdfSaveOptions
PdfSecurityOptions
PicFormatOption
Picture
PictureBulletValue
PictureCollection
PivotField
PivotFieldCollection
PivotFilter
PivotFilterCollection
PivotFormatCondition
PivotFormatConditionCollection
PivotItem
PivotItemCollection
PivotOptions
PivotPageFields
PivotTable
PivotTableCollection
PlotArea
PptxSaveOptions
ProtectedRange
ProtectedRangeCollection
Protection
QueryTable
QueryTableCollection
RadioButton
RadioButtonActiveXControl
Range
RangeCollection
RectangleShape
ReferredArea
ReferredAreaCollection
ReflectionEffect
ReplaceOptions
Revision
RevisionAutoFormat
RevisionCellChange
RevisionCellComment
RevisionCellMove
RevisionCollection
RevisionCustomView
RevisionDefinedName
RevisionFormat
RevisionInsertDelete
RevisionInsertSheet
RevisionLog
RevisionLogCollection
RevisionMergeConflict
RevisionQueryTable
RevisionRenameSheet
Row
RowCollection
SaveOptions
Scenario
ScenarioCollection
ScenarioInputCell
ScenarioInputCellCollection
ScrollBar
ScrollBarActiveXControl
Series
SeriesCollection
SeriesLayoutProperties
ShadowEffect
Shape
ShapeCollection
ShapeFormat
ShapeGuide
ShapeGuideCollection
ShapePath
ShapePathCollection
ShapePathPoint
ShapePathPointCollection
ShapePropertyCollection
ShapeSegmentPath
ShapeSegmentPathCollection
ShapeTextAlignment
SheetPrintingPreview
SheetRender
SignatureLine
Slicer
SlicerCache
SlicerCacheItem
SlicerCacheItemCollection
SlicerCollection
SmartArtShape
SmartTag
SmartTagCollection
SmartTagOptions
SmartTagProperty
SmartTagPropertyCollection
SmartTagSetting
SolidFill
Sparkline
SparklineCollection
SparklineGroup
SparklineGroupCollection
SpinButtonActiveXControl
Spinner
SpreadsheetML2003SaveOptions
StreamProviderOptions
Style
StyleFlag
SubtotalSetting
SvgSaveOptions
SxRng
TableStyle
TableStyleCollection
TableStyleElement
TableStyleElementCollection
TableToRangeOptions
TextBox
TextBoxActiveXControl
TextBoxCollection
TextEffectFormat
TextOptions
TextParagraph
TextParagraphCollection
TextTabStop
TextTabStopCollection
TextureFill
ThemeColor
ThreadedComment
ThreadedCommentAuthor
ThreadedCommentAuthorCollection
ThreadedCommentCollection
ThreeDFormat
TickLabelItem
TickLabels
TilePicOption
Timeline
TimelineCollection
Title
ToggleButtonActiveXControl
Top10
Top10Filter
Trendline
TrendlineCollection
TxtLoadOptions
TxtSaveOptions
UnionRange
UnknownControl
Validation
ValidationCollection
VbaModule
VbaModuleCollection
VbaProject
VbaProjectReference
VbaProjectReferenceCollection
VerticalPageBreak
VerticalPageBreakCollection
VmlShapeGuide
Walls
WarningInfo
WebExtension
WebExtensionBinding
WebExtensionBindingCollection
WebExtensionCollection
WebExtensionProperty
WebExtensionPropertyCollection
WebExtensionReference
WebExtensionReferenceCollection
WebExtensionShape
WebExtensionTaskPane
WebExtensionTaskPaneCollection
WebQueryConnection
Workbook
WorkbookDesigner
WorkbookMetadata
WorkbookPrintingPreview
WorkbookRender
WorkbookSettings
Worksheet
WorksheetCollection
WriteProtection
XlsbSaveOptions
XlsSaveOptions
XmlColumnProperty
XmlDataBinding
XmlLoadOptions
XmlMap
XmlMapCollection
XmlSaveOptions
XpsSaveOptions
Interfaces 
ICellsDataTable
ICustomFunction
ICustomParser
IExportObjectListener
IFilePathProvider
IPageSavingCallback
ISmartMarkerCallBack
IStreamProvider
IWarningCallback
LightCellsDataHandler
LightCellsDataProvider
Constants 
AccessCacheOptions
ActiveXPersistenceType
AutoFillType
AutoFitMergedCellsType
AutoFitWrappedTextType
AutoShapeType
AxisType
BackgroundMode
BackgroundType
Bar3DShapeType
BevelPresetType
BevelType
BorderType
BubbleSizeRepresents
BuiltinStyleType
BulletType
CalcModeType
CalculationPrecisionStrategy
CategoryType
CellBorderType
CellValueFormatStrategy
CellValueType
ChartLineFormattingType
ChartMarkerType
ChartSplitType
ChartTextDirectionType
ChartType
CheckValueType
ColorDepth
ColorType
CommentTitleType
ConnectionDataSourceType
ConnectionParameterType
ConsolidationFunction
ControlBorderType
ControlCaptionAlignmentType
ControlListStyle
ControlMatchEntryType
ControlMousePointerType
ControlPictureAlignmentType
ControlPicturePositionType
ControlPictureSizeMode
ControlScrollBarType
ControlScrollOrientation
ControlSpecialEffectType
ControlType
CopyFormatType
CountryCode
CredentialsMethodType
CrossType
DataBarAxisPosition
DataBarBorderType
DataBarFillType
DataBarNegativeColorType
DataLabelShapeType
DataLabelsSeparatorType
DataLablesSeparatorType
DateTimeGroupingType
DefaultEditLanguage
DirectoryType
DisplayDrawingObjects
DisplayUnitType
DrawObjectEnum
DropButtonStyle
DynamicFilterType
EmfRenderSetting
EncryptionType
ErrorBarDisplayType
ErrorBarType
ErrorCheckType
ExceptionType
ExternalLinkType
FileFormatType
FillPattern
FillPictureType
FillType
FilterOperatorType
FilterType
FontSchemeType
FontSourceType
FontUnderlineType
FormatConditionType
FormatConditionValueType
FormatSetType
FormattingType
GradientColorType
GradientDirectionType
GradientFillType
GradientPresetType
GradientStyleType
GridlineType
HeaderFooterCommandType
HtmlCrossType
HtmlExportDataOptions
HtmlFormatHandlingType
HtmlHiddenColDisplayType
HtmlHiddenRowDisplayType
HtmlLinkTargetType
IconSetType
ImageType
InputMethodEditorMode
LabelPositionType
LegendPositionType
LightRigDirectionType
LightRigType
LineCapType
LineJoinType
LineSpaceSizeType
LineType
LoadDataFilterOptions
LoadFormat
LookAtType
LookInType
MapChartLabelLayout
MapChartProjectionType
MapChartRegionType
MemorySetting
MetadataType
MirrorType
MsoArrowheadLength
MsoArrowheadStyle
MsoArrowheadWidth
MsoDrawingType
MsoLineDashStyle
MsoLineStyle
MsoPresetTextEffect
MsoPresetTextEffectShape
NameScopeType
NumberCategoryType
OdsCellFieldType
OdsGeneratorType
OdsPageBackgroundGraphicPositionType
OdsPageBackgroundGraphicType
OdsPageBackgroundType
OLEDBCommandType
OoxmlCompliance
OoxmlCompressionType
OperatorType
PageLayoutAlignmentType
PageOrientationType
PaneStateType
PaperSizeType
ParameterType
PasteOperationType
PasteType
PdfCompliance
PdfCompressionCore
PdfCustomPropertiesExport
PdfFontEncoding
PdfOptimizationType
PivotConditionFormatRuleType
PivotConditionFormatScopeType
PivotFieldDataDisplayFormat
PivotFieldSubtotalType
PivotFieldType
PivotFilterType
PivotGroupByType
PivotItemPosition
PivotMissingItemLimitType
PivotTableAutoFormatType
PivotTableStyleType
PlacementType
PlotDataByType
PlotEmptyCellsType
PresetCameraType
PresetMaterialType
PresetShadowType
PresetWordArtStyle
PrintCommentsType
PrintErrorsType
PrintingPageType
PrintOrderType
PrintSizeType
PropertyType
ProtectionType
QuartileCalculationType
ReConnectionMethodType
RectangleAlignmentType
ReflectionEffectType
RenameStrategy
ResourceLoadingType
RevisionActionType
RevisionType
SaveFormat
SelectionType
ShapeAnchorType
ShapeLockType
ShapePathType
SheetType
ShiftType
ShowDropButtonType
SlicerCacheCrossFilterType
SlicerCacheItemSortType
SlicerStyleType
SmartTagShowType
SortOnType
SortOrder
SparklineAxisMinMaxType
SparklinePresetStyleType
SparklineType
SqlDataType
StyleModifyFlag
TableDataSourceType
TableStyleElementType
TableStyleType
TargetModeType
TextAlignmentType
TextAutonumberScheme
TextCapsType
TextCrossType
TextDirectionType
TextFontAlignType
TextNodeType
TextOrientationType
TextOverflowType
TextStrikeType
TextTabAlignmentType
TextureType
TextVerticalType
ThemeColorType
TickLabelPositionType
TickMarkType
TiffCompression
TimePeriodType
TimeUnit
TotalsCalculation
TrendlineType
TxtLoadStyleStrategy
TxtValueQuoteType
UpdateLinksType
ValidationAlertType
ValidationType
VbaModuleType
VbaProjectReferenceType
ViewType
VisibilityType
WarningType
WebExtensionStoreType
WeightType
XAdESType

com.aspose.cells
Class Workbook

java.lang.Object
    extended by com.aspose.cells.Workbook

public class Workbook 
extends java.lang.Object

Represents a root object to create an Excel spreadsheet. The Workbook class denotes an Excel spreadsheet. Each spreadsheet can contain multiple worksheets. The basic feature of the class is to open and save native excel files. The class has some advanced features like copying data from other Workbooks, combining two Workbooks and protecting the Excel spreadsheet.

Example:

//Open a designer file
String designerFile = "designer.xls";
Workbook workbook = new Workbook(designerFile);

//Set scroll bars
workbook.getSettings().setHScrollBarVisible(false);
workbook.getSettings().setVScrollBarVisible(false);

//Replace the placeholder string with new values
int newInt = 100;
workbook.replace("OldInt", newInt);

String newString = "Hello!";
workbook.replace("OldString", newString);
workbook.save("result.xls");


Constructor Summary
Workbook()
           Initializes a new instance of the Workbook class.
Workbook(int fileFormatType)
           Initializes a new instance of the Workbook class.
Workbook(java.lang.String file)
           Initializes a new instance of the Workbook class and open a file.
Workbook(java.io.InputStream stream)
           Initializes a new instance of the Workbook class and open a stream.
Workbook(java.lang.String file, LoadOptions loadOptions)
           Initializes a new instance of the Workbook class and open a file.
Workbook(java.io.InputStream stream, LoadOptions loadOptions)
           Initializes a new instance of the Workbook class and open stream.
 
Property Getters/Setters Summary
java.lang.StringgetAbsolutePath()
voidsetAbsolutePath(java.lang.String)
           Gets and sets the absolute path of the file.
BuiltInDocumentPropertyCollectiongetBuiltInDocumentProperties()
           Returns a DocumentProperty collection that represents all the built-in document properties of the spreadsheet.
CellsDataTableFactorygetCellsDataTableFactory()
           Gets the factory for building ICellsDataTable from custom objects
com.aspose.cells.Color[]getColors()
           Returns colors in the palette for the spreadsheet.
ContentTypePropertyCollectiongetContentTypeProperties()
           Gets the list of ContentTypeProperty objects in the workbook.
intgetCountOfStylesInPool()
           Gets number of the styles in the style pool.
CustomDocumentPropertyCollectiongetCustomDocumentProperties()
           Returns a DocumentProperty collection that represents all the custom document properties of the spreadsheet.
CustomXmlPartCollectiongetCustomXmlParts()
           Represents a Custom XML Data Storage Part (custom XML data within a package).
ExternalConnectionCollectiongetDataConnections()
           Gets the ExternalConnection collection.
Aspose.Cells.QueryTables.DataMashupgetDataMashup()
           Gets mashup data.
DataSortergetDataSorter()
           Gets a DataSorter object to sort data.
StylegetDefaultStyle()
voidsetDefaultStyle(Style)
           Gets or sets the default Style object of the workbook.
intgetFileFormat()
voidsetFileFormat(int)
           Gets and sets the file format. The value of the property is FileFormatType integer constant.
java.lang.StringgetFileName()
voidsetFileName(java.lang.String)
           Gets and sets the current file name.
booleanhasMacro()
           Indicates if this spreadsheet contains macro/VBA.
booleanhasRevisions()
           Gets if the workbook has any tracked changes
AbstractInterruptMonitorgetInterruptMonitor()
voidsetInterruptMonitor(AbstractInterruptMonitor)
           Gets and sets the interrupt monitor.
booleanisDigitallySigned()
           Indicates if this spreadsheet is digitally signed.
booleanisLicensed()
           Indicates whether license is set.
booleanisWorkbookProtectedWithPassword()
           Indicates whether structure or window is protected with password.
java.lang.StringgetRibbonXml()
voidsetRibbonXml(java.lang.String)
           Gets and sets the XML file that defines the Ribbon UI.
WorkbookSettingsgetSettings()
           Represents the workbook settings.
java.lang.StringgetTheme()
           Gets the theme name.
VbaProjectgetVbaProject()
           Gets the VbaProject in a spreadsheet.
WorksheetCollectiongetWorksheets()
           Gets the WorksheetCollection collection in the spreadsheet.
 
Method Summary
voidacceptAllRevisions()
           Accepts all tracked changes in the workbook.
voidaddDigitalSignature(DigitalSignatureCollection digitalSignatureCollection)
           Adds digital signature to an OOXML spreadsheet file (Excel2007 and later).
voidcalculateFormula()
           Calculates the result of formulas.
voidcalculateFormula(boolean ignoreError)
           Calculates the result of formulas.
voidcalculateFormula(boolean ignoreError, ICustomFunction customFunction)
           Calculates the result of formulas.
voidcalculateFormula(CalculationOptions options)
           Calculating formulas in this workbook.
voidchangePalette(com.aspose.cells.Color color, int index)
           Changes the palette for the spreadsheet in the specified index.
voidcloseAccessCache(int opts)
           Closes the session that uses caches to access data.
voidcombine(Workbook secondWorkbook)
           Combines another Workbook object.
voidcopy(Workbook source)
           Copies data from a source Workbook object.
voidcopy(Workbook source, CopyOptions copyOptions)
           Copies data from a source Workbook object.
voidcopyTheme(Workbook source)
           Copies the theme from another workbook.
StylecreateBuiltinStyle(int type)
           Creates built-in style by given type.
CellsColorcreateCellsColor()
           Creates a CellsColor object.
StylecreateStyle()
           Creates a new style.
voidcustomTheme(java.lang.String themeName, com.aspose.cells.Color[] colors)
           Customs the theme.
voiddispose()
           Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
voidexportXml(java.lang.String mapName, java.io.OutputStream stream)
           Export XML data linked by the specified XML map.
voidexportXml(java.lang.String mapName, java.lang.String path)
           Export XML data linked by the specified XML map.
DigitalSignatureCollectiongetDigitalSignature()
           Gets digital signature from file.
com.aspose.cells.Font[]getFonts()
           Gets all fonts in the style pool.
com.aspose.cells.ColorgetMatchingColor(com.aspose.cells.Color rawColor)
           Find best matching Color in current palette.
StylegetNamedStyle(java.lang.String name)
           Gets the named style in the style pool.
StylegetStyleInPool(int index)
           Gets the style in the style pool. All styles in the workbook will be gathered into a pool. There is only a simple reference index in the cells.
com.aspose.cells.ColorgetThemeColor(int type)
           Gets theme color.
booleanhasExernalLinks()
           Indicates whether this workbook contains external links to other data sources.
voidimportXml(java.io.InputStream stream, java.lang.String sheetName, int row, int col)
           Imports/Updates an XML data file into the workbook.
voidimportXml(java.lang.String url, java.lang.String sheetName, int row, int col)
           Imports/Updates an XML data file into the workbook.
booleanisColorInPalette(com.aspose.cells.Color color)
           Checks if a color is in the palette for the spreadsheet.
voidparseFormulas(boolean ignoreError)
           Parses all formulas which have not been parsed when they were loaded from template file or set to a cell.
voidprotect(int protectionType, java.lang.String password)
           Protects a workbook.
voidprotectSharedWorkbook(java.lang.String password)
           Protects a shared workbook.
voidrefreshDynamicArrayFormulas(boolean calculate)
           Refreshes dynamic array formulas(spill into new range of neighboring cells according to current data)
voidremoveDigitalSignature()
           Removes digital signature from this spreadsheet.
voidremoveExternalLinks()
           Removes all external links in the workbook.
voidremoveMacro()
           Removes VBA/macro from this spreadsheet.
voidremovePersonalInformation()
           Removes personal information.
voidremoveUnusedStyles()
           Remove all unused styles.
intreplace(boolean boolValue, java.lang.Object newValue)
           Replaces cells' values with new data.
intreplace(int intValue, java.lang.Object newValue)
           Replaces cells' values with new data.
intreplace(java.lang.String placeHolder, double newValue)
           Replaces a cell's value with a new double.
intreplace(java.lang.String placeHolder, double[] newValues, boolean isVertical)
           Replaces cells' values with a double array.
intreplace(java.lang.String placeHolder, int newValue)
           Replaces a cell's value with a new integer.
intreplace(java.lang.String placeHolder, int[] newValues, boolean isVertical)
           Replaces cells' values with an integer array.
intreplace(java.lang.String placeHolder, java.lang.String newValue)
           Replaces a cell's value with a new string.
intreplace(java.lang.String placeHolder, java.lang.String newValue, ReplaceOptions options)
           Replaces a cell's value with a new string.
intreplace(java.lang.String placeHolder, java.lang.String[] newValues, boolean isVertical)
           Replaces a cell's value with a new string array.
voidsave(java.io.OutputStream stream, SaveOptions saveOptions)
           Save the workbook to the stream.
voidsave(java.io.OutputStream stream, int saveFormat)
           Save the workbook to the stream.
voidsave(java.lang.String fileName)
           Save the workbook to the disk.
voidsave(java.lang.String fileName, SaveOptions saveOptions)
           Saves the workbook to the disk.
voidsave(java.lang.String fileName, int saveFormat)
           Saves the workbook to the disk.
voidsetDigitalSignature(DigitalSignatureCollection digitalSignatureCollection)
           Sets digital signature to an spreadsheet file (Excel2007 and later).
voidsetEncryptionOptions(int encryptionType, int keyLength)
           Set Encryption Options.
voidsetThemeColor(int type, com.aspose.cells.Color color)
           Sets the theme color
voidstartAccessCache(int opts)
           Starts the session that uses caches to access data.
voidunprotect(java.lang.String password)
           Unprotects a workbook.
voidunprotectSharedWorkbook(java.lang.String password)
           Unprotects a shared workbook.
voidupdateLinkedDataSource(com.aspose.cells.Workbook[] externalWorkbooks)
           If this workbook contains external links to other data source, Aspose.Cells will attempt to retrieve the latest data.
 

Constructor Detail

Workbook

public Workbook()
Initializes a new instance of the Workbook class. The default file format type is Excel97To2003.If want create other format file type, please call Workbook(FileFormatType fileFormatType).

Example:

Workbook workbook = new Workbook();

Workbook

public Workbook(int fileFormatType)
Initializes a new instance of the Workbook class. The default file format type is Excel97To2003.
Parameters:
fileFormatType - A FileFormatType value. The new file format.

Example:

Workbook workbook = new Workbook(FileFormatType.XLSX);

Workbook

public Workbook(java.lang.String file)
         throws java.lang.Exception
Initializes a new instance of the Workbook class and open a file.
Parameters:
file - The file name.

Workbook

public Workbook(java.io.InputStream stream)
         throws java.lang.Exception
Initializes a new instance of the Workbook class and open a stream.
Parameters:
stream - The stream.

Workbook

public Workbook(java.lang.String file, LoadOptions loadOptions)
         throws java.lang.Exception
Initializes a new instance of the Workbook class and open a file.
Parameters:
file - The file name.
loadOptions - The load options

Workbook

public Workbook(java.io.InputStream stream, LoadOptions loadOptions)
         throws java.lang.Exception
Initializes a new instance of the Workbook class and open stream.
Parameters:
stream - The stream.
loadOptions - The load options

Property Getters/Setters Detail

getSettings

public WorkbookSettings getSettings()
Represents the workbook settings.

getWorksheets

public WorksheetCollection getWorksheets()
Gets the WorksheetCollection collection in the spreadsheet.
Returns:
WorksheetCollection collection

isLicensed

public boolean isLicensed()
Indicates whether license is set.

getColors

public com.aspose.cells.Color[] getColors()
Returns colors in the palette for the spreadsheet. The palette has 56 entries, each represented by an RGB value.

getCountOfStylesInPool

public int getCountOfStylesInPool()
Gets number of the styles in the style pool.

getDefaultStyle/setDefaultStyle

public Style getDefaultStyle() / public void setDefaultStyle(Style value)
Gets or sets the default Style object of the workbook. The DefaultStyle property is useful to implement a Style for the whole Workbook.

Example:

Workbook workbook = new Workbook();
Style defaultStyle = workbook.getDefaultStyle();
defaultStyle.getFont().setName("Tahoma");
workbook.setDefaultStyle(defaultStyle);

isDigitallySigned

public boolean isDigitallySigned()
Indicates if this spreadsheet is digitally signed.

isWorkbookProtectedWithPassword

public boolean isWorkbookProtectedWithPassword()
Indicates whether structure or window is protected with password.

getVbaProject

public VbaProject getVbaProject()
Gets the VbaProject in a spreadsheet.

hasMacro

public boolean hasMacro()
Indicates if this spreadsheet contains macro/VBA.

hasRevisions

public boolean hasRevisions()
Gets if the workbook has any tracked changes

getFileName/setFileName

public java.lang.String getFileName() / public void setFileName(java.lang.String value)
Gets and sets the current file name. If the file is opened by stream and there are some external formula references, please set the file name.

getCellsDataTableFactory

public CellsDataTableFactory getCellsDataTableFactory()
Gets the factory for building ICellsDataTable from custom objects

getDataSorter

public DataSorter getDataSorter()
Gets a DataSorter object to sort data.

getTheme

public java.lang.String getTheme()
Gets the theme name.

getBuiltInDocumentProperties

public BuiltInDocumentPropertyCollection getBuiltInDocumentProperties()
Returns a DocumentProperty collection that represents all the built-in document properties of the spreadsheet. A new property cannot be added to built-in document properties list. You can only get a built-in property and change its value. The following is the built-in properties name list:

Title

Subject

Author

Keywords

Comments

Template

Last Author

Revision Number

Application Name

Last Print Date

Creation Date

Last Save Time

Total Editing Time

Number of Pages

Number of Words

Number of Characters

Security

Category

Format

Manager

Company

Number of Bytes

Number of Lines

Number of Paragraphs

Number of Slides

Number of Notes

Number of Hidden Slides

Number of Multimedia Clips

Example:

Workbook workbook = new Workbook();
DocumentProperty doc = workbook.getBuiltInDocumentProperties().get("Author");
doc.setValue("John Smith");

getCustomDocumentProperties

public CustomDocumentPropertyCollection getCustomDocumentProperties()
Returns a DocumentProperty collection that represents all the custom document properties of the spreadsheet.

Example:

Workbook excel = new Workbook();
excel.getCustomDocumentProperties().add("Checked by", "Jane");

getFileFormat/setFileFormat

public int getFileFormat() / public void setFileFormat(int value)
Gets and sets the file format. The value of the property is FileFormatType integer constant.

getInterruptMonitor/setInterruptMonitor

public AbstractInterruptMonitor getInterruptMonitor() / public void setInterruptMonitor(AbstractInterruptMonitor value)
Gets and sets the interrupt monitor.

getContentTypeProperties

public ContentTypePropertyCollection getContentTypeProperties()
Gets the list of ContentTypeProperty objects in the workbook.

getCustomXmlParts

public CustomXmlPartCollection getCustomXmlParts()
Represents a Custom XML Data Storage Part (custom XML data within a package).

getDataMashup

public Aspose.Cells.QueryTables.DataMashup getDataMashup()
Gets mashup data.

getRibbonXml/setRibbonXml

public java.lang.String getRibbonXml() / public void setRibbonXml(java.lang.String value)
Gets and sets the XML file that defines the Ribbon UI.

getAbsolutePath/setAbsolutePath

public java.lang.String getAbsolutePath() / public void setAbsolutePath(java.lang.String value)
Gets and sets the absolute path of the file. Only used for external links.

getDataConnections

public ExternalConnectionCollection getDataConnections()
Gets the ExternalConnection collection.

Method Detail

dispose

public void dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

parseFormulas

public void parseFormulas(boolean ignoreError)
Parses all formulas which have not been parsed when they were loaded from template file or set to a cell.
Parameters:
ignoreError - whether ignore error for invalid formula. For one invalid formula, if ignore error then this formula will be ignored and the process will continue to parse other formulas, otherwise exception will be thrown.

startAccessCache

public void startAccessCache(int opts)
Starts the session that uses caches to access data. If the cache of specified data access requires some data models in worksheet to be "read-only", then corresponding data models in every worksheet in this workbook will be taken as "read-only" and user should not change any of them.
After finishing the access to the data, closeAccessCache(int) should be invoked with same options to clear all caches and recover normal access mode.
Parameters:
opts - A AccessCacheOptions value. options of data access

closeAccessCache

public void closeAccessCache(int opts)
Closes the session that uses caches to access data.
Parameters:
opts - A AccessCacheOptions value. options of data access

save

public void save(java.lang.String fileName, int saveFormat)
         throws java.lang.Exception
Saves the workbook to the disk.
Parameters:
fileName - The file name.
saveFormat - A SaveFormat value. The save format type.

save

public void save(java.lang.String fileName)
         throws java.lang.Exception
Save the workbook to the disk.
Parameters:
fileName -

save

public void save(java.lang.String fileName, SaveOptions saveOptions)
         throws java.lang.Exception
Saves the workbook to the disk.
Parameters:
fileName - The file name.
saveOptions - The save options.

save

public void save(java.io.OutputStream stream, SaveOptions saveOptions)
         throws java.lang.Exception
Save the workbook to the stream.
Parameters:
stream - The file stream.
saveOptions - The save options.

save

public void save(java.io.OutputStream stream, int saveFormat)
         throws java.lang.Exception
Save the workbook to the stream.
Parameters:
stream - The file stream.
saveFormat - A SaveFormat value. The save file format type.

removeUnusedStyles

public void removeUnusedStyles()
Remove all unused styles.

createStyle

public Style createStyle()
Creates a new style.
Returns:
Returns a style object.

createBuiltinStyle

public Style createBuiltinStyle(int type)
Creates built-in style by given type.
Parameters:
type - A BuiltinStyleType value.
Returns:
style object

createCellsColor

public CellsColor createCellsColor()
Creates a CellsColor object.
Returns:
Returns a CellsColor object.

replace

public int replace(java.lang.String placeHolder, java.lang.String newValue)
Replaces a cell's value with a new string.
Parameters:
placeHolder - Cell placeholder
newValue - String value to replace

Example:

Workbook workbook = new Workbook();
//......
workbook.replace("AnOldValue", "NewValue");

replace

public int replace(java.lang.String placeHolder, int newValue)
Replaces a cell's value with a new integer.
Parameters:
placeHolder - Cell placeholder
newValue - Integer value to replace

Example:

Workbook workbook = new Workbook();
//......
int newValue = 100;
workbook.replace("AnOldValue", newValue);

replace

public int replace(java.lang.String placeHolder, double newValue)
Replaces a cell's value with a new double.
Parameters:
placeHolder - Cell placeholder
newValue - Double value to replace

Example:

Workbook workbook = new Workbook();
//......
double newValue = 100.0;
workbook.replace("AnOldValue", newValue);

replace

public int replace(java.lang.String placeHolder, java.lang.String[] newValues, boolean isVertical)
Replaces a cell's value with a new string array.
Parameters:
placeHolder - Cell placeholder
newValues - String array to replace
isVertical - True - Vertical, False - Horizontal

Example:

Workbook workbook = new Workbook();
//......
String[] newValues = new String[]{"Tom", "Alice", "Jerry"};
workbook.replace("AnOldValue", newValues, true);

replace

public int replace(java.lang.String placeHolder, int[] newValues, boolean isVertical)
Replaces cells' values with an integer array.
Parameters:
placeHolder - Cell placeholder
newValues - Integer array to replace
isVertical - True - Vertical, False - Horizontal

Example:

Workbook workbook = new Workbook();
//......
int[] newValues = new int[]{1, 2, 3};
workbook.replace("AnOldValue", newValues, true);

replace

public int replace(java.lang.String placeHolder, double[] newValues, boolean isVertical)
Replaces cells' values with a double array.
Parameters:
placeHolder - Cell placeholder
newValues - Double array to replace
isVertical - True - Vertical, False - Horizontal

Example:

Workbook workbook = new Workbook();
//......
double[] newValues = new double[]{1.23, 2.56, 3.14159};
workbook.replace("AnOldValue", newValues, true);

replace

public int replace(boolean boolValue, java.lang.Object newValue)
Replaces cells' values with new data.
Parameters:
boolValue - The boolean value to be replaced.
newValue - New value. Can be string, integer, double or DateTime value.

replace

public int replace(int intValue, java.lang.Object newValue)
Replaces cells' values with new data.
Parameters:
intValue - The integer value to be replaced.
newValue - New value. Can be string, integer, double or DateTime value.

replace

public int replace(java.lang.String placeHolder, java.lang.String newValue, ReplaceOptions options)
Replaces a cell's value with a new string.
Parameters:
placeHolder - Cell placeholder
newValue - String value to replace
options - The replace options

copy

public void copy(Workbook source, CopyOptions copyOptions)
         throws java.lang.Exception
Copies data from a source Workbook object.
Parameters:
source - Source Workbook object.
copyOptions -

copy

public void copy(Workbook source)
         throws java.lang.Exception
Copies data from a source Workbook object.
Parameters:
source - Source Workbook object.

combine

public void combine(Workbook secondWorkbook)
            throws java.lang.Exception
Combines another Workbook object. Currently, only cell data and cell style of the second Workbook object can be combined. Images, charts and other drawing objects are not supported.
Parameters:
secondWorkbook - Another Workbook object.

getStyleInPool

public Style getStyleInPool(int index)
Gets the style in the style pool. All styles in the workbook will be gathered into a pool. There is only a simple reference index in the cells. If the returned style is changed, the style of all cells(which refers to this style) will be changed.
Parameters:
index - The index.
Returns:
The style in the pool corresponds to given index, may be null.

getFonts

public com.aspose.cells.Font[] getFonts()
Gets all fonts in the style pool.

getNamedStyle

public Style getNamedStyle(java.lang.String name)
Gets the named style in the style pool.
Parameters:
name - name of the style
Returns:
named style, maybe null.

changePalette

public void changePalette(com.aspose.cells.Color color, int index)
Changes the palette for the spreadsheet in the specified index. The palette has 56 entries, each represented by an RGB value. If you set a color which is not in the palette, it will not take effect. So if you want to set a custom color, please change the palette at first.

The following is the standard color palette.

Color Red Green Blue 
Black 0 0 0 
White 255 255 255 
Red 255 0 0 
Lime 0 255 0 
Blue 0 0 255 
Yellow 255 255 0 
Magenta 255 0 255 
Cyan 0 255 255 
Maroon 128 0 0 
Green 0 128 0 
Navy 0 0 128 
Olive 128 128 0 
Purple 128 0 128 
Teal 0 128 128 
Silver 192 192 192 
Gray 128 128 128 
Color17 153 153 255 
Color18 153 51 102 
Color19 255 255 204 
Color20 204 255 255 
Color21 102 0 102 
Color22 255 128 128 
Color23 0 102 204 
Color24 204 204 255 
Color25 0 0 128 
Color26 255 0 255 
Color27 255 255 0 
Color28 0 255 255 
Color29 128 0 128 
Color30 128 0 0 
Color31 0 128 128 
Color32 0 0 255 
Color33 0 204 255 
Color34 204 255 255 
Color35 204 255 204 
Color36 255 255 153 
Color37 153 204 255 
Color38 255 153 204 
Color39 204 153 255 
Color40 255 204 153 
Color41 51 102 255 
Color42 51 204 204 
Color43 153 204 0 
Color44 255 204 0 
Color45 255 153 0 
Color46 255 102 0 
Color47 102 102 153 
Color48 150 150 150 
Color49 0 51 102 
Color50 51 153 102 
Color51 0 51 0 
Color52 51 51 0 
Color53 153 51 0 
Color54 153 51 102 
Color55 51 51 153 
Color56 51 51 51 
Parameters:
color - Color structure.
index - Palette index, 0 - 55.

isColorInPalette

public boolean isColorInPalette(com.aspose.cells.Color color)
Checks if a color is in the palette for the spreadsheet.
Parameters:
color - Color structure.
Returns:
Returns true if this color is in the palette. Otherwise, returns false

calculateFormula

public void calculateFormula()
Calculates the result of formulas. For all supported formulas, please see the list at https://docs.aspose.com/display/cellsnet/Supported+Formula+Functions

calculateFormula

public void calculateFormula(boolean ignoreError)
Calculates the result of formulas.
Parameters:
ignoreError - Indicates if hide the error in calculating formulas. The error may be unsupported function, external links, etc.

calculateFormula

public void calculateFormula(boolean ignoreError, ICustomFunction customFunction)
Calculates the result of formulas. NOTE: This member is now obsolete. Instead, please use CalculateFormula(CalculationOptions) method. This method will be removed 12 months later since August 2020. Aspose apologizes for any inconvenience you may have experienced.
Parameters:
ignoreError - Indicates if hide the error in calculating formulas. The error may be unsupported function, external links, etc.
customFunction - The custom formula calculation functions to extend the calculation engine.

calculateFormula

public void calculateFormula(CalculationOptions options)
Calculating formulas in this workbook.
Parameters:
options - Options for calculation

refreshDynamicArrayFormulas

public void refreshDynamicArrayFormulas(boolean calculate)
Refreshes dynamic array formulas(spill into new range of neighboring cells according to current data)
Parameters:
calculate - Whether calculates and update cell values for those dynamic array formulas when the spilled range changes.

getMatchingColor

public com.aspose.cells.Color getMatchingColor(com.aspose.cells.Color rawColor)
Find best matching Color in current palette.
Parameters:
rawColor - Raw color.
Returns:
Best matching color.

setEncryptionOptions

public void setEncryptionOptions(int encryptionType, int keyLength)
Set Encryption Options.
Parameters:
encryptionType - A EncryptionType value. The encryption type.
keyLength - The key length.

protect

public void protect(int protectionType, java.lang.String password)
Protects a workbook.
Parameters:
protectionType - A ProtectionType value. Protection type.
password - Password to protect the workbook.

protectSharedWorkbook

public void protectSharedWorkbook(java.lang.String password)
Protects a shared workbook.
Parameters:
password - Password to protect the workbook.

unprotect

public void unprotect(java.lang.String password)
Unprotects a workbook.
Parameters:
password - Password to unprotect the workbook.

unprotectSharedWorkbook

public void unprotectSharedWorkbook(java.lang.String password)
Unprotects a shared workbook.
Parameters:
password - Password to unprotect the workbook.

removeMacro

public void removeMacro()
Removes VBA/macro from this spreadsheet.

removeDigitalSignature

public void removeDigitalSignature()
Removes digital signature from this spreadsheet.

acceptAllRevisions

public void acceptAllRevisions()
Accepts all tracked changes in the workbook.

removeExternalLinks

public void removeExternalLinks()
Removes all external links in the workbook. NOTE: This member is now obsolete. Instead, please use ExternalLinkCollection.Clear() method. This method will be removed 12 months later since December 2021. Aspose apologizes for any inconvenience you may have experienced.

getThemeColor

public com.aspose.cells.Color getThemeColor(int type)
Gets theme color.
Parameters:
type - A ThemeColorType value. The theme color type.
Returns:
The theme color.

setThemeColor

public void setThemeColor(int type, com.aspose.cells.Color color)
Sets the theme color
Parameters:
type - A ThemeColorType value. The theme color type.
color - the theme color

customTheme

public void customTheme(java.lang.String themeName, com.aspose.cells.Color[] colors)
Customs the theme. The length of colors should be 12.
Array index Theme type 
0 Backgournd1 
1 Text1 
2 Backgournd2 
3 Text2 
4 Accent1 
5 Accent2 
6 Accent3 
7 Accent4 
8 Accent5 
9 Accent6 
10 Hyperlink 
11 Followed Hyperlink 
Parameters:
themeName - The theme name
colors - The theme colors

copyTheme

public void copyTheme(Workbook source)
Copies the theme from another workbook.
Parameters:
source - Source workbook.

hasExernalLinks

public boolean hasExernalLinks()
Indicates whether this workbook contains external links to other data sources. NOTE: This member is now obsolete. Instead, please use ExternalLinkCollection.Count to check whether there are external links in this workbook. This method will be removed 12 months later since December 2021. Aspose apologizes for any inconvenience you may have experienced.
Returns:
Whether this workbook contains external links to other data sources.

updateLinkedDataSource

public void updateLinkedDataSource(com.aspose.cells.Workbook[] externalWorkbooks)
                           throws java.lang.Exception
If this workbook contains external links to other data source, Aspose.Cells will attempt to retrieve the latest data. If the method is not called before calculating formulas, Aspose.Cells will use the previous information(cached in the file); Please set CellsHelper.StartupPath,CellsHelper.AltStartPath,CellsHelper.LibraryPath. And please set Workbook.FilePath if this workbook is from a stream, otherwise Aspose.Cells could not get the external link full path sometimes.
Parameters:
externalWorkbooks - External workbooks are referenced by this workbook. If it's null, we will directly open the external linked files.. If it's not null, we will check whether the external link in the array first; if not, we will open the external linked files again.

importXml

public void importXml(java.lang.String url, java.lang.String sheetName, int row, int col)
              throws java.lang.Exception
Imports/Updates an XML data file into the workbook.
Parameters:
url - the url/path of the xml file.
sheetName - the destination sheet name.
row - the destination row
col - the destination column

Example:

Workbook wb = new Workbook("Book1.xlsx");

wb.importXml("xml.xml", "Sheet1", 0, 0);

wb.save("output.xlsx");

importXml

public void importXml(java.io.InputStream stream, java.lang.String sheetName, int row, int col)
              throws java.lang.Exception
Imports/Updates an XML data file into the workbook.
Parameters:
stream - the xml file stream.
sheetName - the destination sheet name.
row - the destination row.
col - the destination column.

exportXml

public void exportXml(java.lang.String mapName, java.lang.String path)
              throws java.lang.Exception
Export XML data linked by the specified XML map.
Parameters:
mapName - name of the XML map that need to be exported
path - the export path

Example:

Workbook wb = new Workbook("Book1.xlsx");

//Make sure that the source xlsx file contains a XmlMap.
XmlMap xmlMap = wb.getWorksheets().getXmlMaps().get(0);

wb.exportXml(xmlMap.getName(), "output.xml");

exportXml

public void exportXml(java.lang.String mapName, java.io.OutputStream stream)
              throws java.lang.Exception
Export XML data linked by the specified XML map.
Parameters:
mapName - name of the XML map that need to be exported
stream - the export stream

setDigitalSignature

public void setDigitalSignature(DigitalSignatureCollection digitalSignatureCollection)
Sets digital signature to an spreadsheet file (Excel2007 and later). Only support adding Xmldsig Digital Signature
Parameters:
digitalSignatureCollection -

addDigitalSignature

public void addDigitalSignature(DigitalSignatureCollection digitalSignatureCollection)
Adds digital signature to an OOXML spreadsheet file (Excel2007 and later). Only support adding Xmldsig Digital Signature to an OOXML spreadsheet file
Parameters:
digitalSignatureCollection -

getDigitalSignature

public DigitalSignatureCollection getDigitalSignature()
Gets digital signature from file.

removePersonalInformation

public void removePersonalInformation()
Removes personal information.

See Also:
          Aspose.Cells Documentation - the home page for the Aspose.Cells Product Documentation.
          Aspose.Cells Support Forum - our preferred method of support.