Constructor and Description |
---|
SheetOperationUtil() |
Modifier and Type | Method and Description |
---|---|
static Chart |
addChart(Range range,
Chart.Type type,
Chart.Grouping grouping,
Chart.LegendPosition pos)
Adds chart to range
|
static Chart |
addChart(Range range,
SheetAnchor anchor,
Chart.Type type,
Chart.Grouping grouping,
Chart.LegendPosition pos)
Adds chart to range
|
static Picture |
addPicture(Range range,
org.zkoss.image.AImage image)
Add picture to the range
|
static Picture |
addPicture(Range range,
byte[] binary,
Picture.Format format,
int widthPx,
int heightPx)
Add picture to the range
|
static Picture |
addPicture(Range range,
SheetAnchor anchor,
byte[] binary,
Picture.Format format)
Add picture to the range
|
static void |
addSheet(Range range,
String prefix)
Add a new sheet to this book
|
static void |
applyAutoFilter(Range range)
Re-apply autofilter
|
static void |
CopySheet(Range range)
Copy the sheet with the naming pattern "ORIGINAL_FILENAME (n)".
|
static void |
createSheet(Range range,
String name)
Add a new sheet to this book
|
static void |
deleteChart(Range range,
Chart chart)
Delete a chart.
|
static void |
deletePicture(Range range,
Picture picture)
Delete a picture
|
static void |
deleteSheet(Range range)
Deletes the sheet, notice that it prevents you from deleting the last sheet
|
static void |
displaySheetGridlines(Range range,
boolean enable)
Enables/disables sheet gridlines.
|
static Picture.Format |
getPictureFormat(org.zkoss.image.AImage image)
Gets the picture format
|
static boolean |
hasChart(Range range,
Chart chart)
Determine whether the range of sheet has the chart.
|
static boolean |
hasPicture(Range range,
Picture picture)
Determine whether the range of sheet has the picture
|
static void |
moveChart(Range range,
Chart chart,
int rowIndex,
int columnIndex)
Move a chart to specified row and column.
|
static void |
movePicture(Range range,
Picture picture,
int rowIndex,
int columnIndex)
Move a picture to specified row and column.
|
static void |
protectSheet(Range range,
String password,
boolean allowSelectingLockedCells,
boolean allowSelectingUnlockedCells,
boolean allowFormattingCells,
boolean allowFormattingColumns,
boolean allowFormattingRows,
boolean allowInsertColumns,
boolean allowInsertRows,
boolean allowInsertingHyperlinks,
boolean allowDeletingColumns,
boolean allowDeletingRows,
boolean allowSorting,
boolean allowFiltering,
boolean allowUsingPivotTables,
boolean drawingObjects,
boolean scenarios) |
static void |
protectSheet(Range range,
String password,
String newpasswrod) |
static void |
renameSheet(Range range,
String newname)
Rename a sheet
|
static void |
resetAutoFilter(Range range)
Resets autofilter
|
static void |
setSheetOrder(Range range,
int pos)
Sets the sheet order
|
static SheetAnchor |
toChartAnchor(Range range)
Create a anchor by range's row/column data
|
static SheetAnchor |
toFilledAnchor(Sheet sheet,
int row,
int column,
int widthPx,
int heightPx)
return a
SheetAnchor based on a cell and a picture width and height |
static void |
toggleAutoFilter(Range range)
Toggles autofilter on or off
|
static boolean |
unprotectSheet(Range range,
String password) |
public static void toggleAutoFilter(Range range)
range
- the range to togglepublic static void resetAutoFilter(Range range)
range
- the range to resetpublic static void applyAutoFilter(Range range)
range
- the range to applypublic static Picture addPicture(Range range, org.zkoss.image.AImage image)
range
- the range to add picture toimage
- the imagepublic static Picture addPicture(Range range, byte[] binary, Picture.Format format, int widthPx, int heightPx)
range
- the range to add picturebinary
- the image binary dataformat
- the image formatwidthPx
- the width of image to placeheightPx
- the height of image to placepublic static Picture addPicture(Range range, SheetAnchor anchor, byte[] binary, Picture.Format format)
range
- the range to add pictureanchor
- the picture locationbinary
- the image binary dataformat
- the image formatpublic static Picture.Format getPictureFormat(org.zkoss.image.AImage image)
image
- the imagepublic static void movePicture(Range range, Picture picture, int rowIndex, int columnIndex)
range
- a range represented the sheet that contains the picturepicture
- the picture to moverowIndex
- destination row index, 0-basedcolumnIndex
- destination column index, 0-basedpublic static void deletePicture(Range range, Picture picture)
range
- a range that represents the sheet that contains the picturepicture
- the picture to deletepublic static boolean hasPicture(Range range, Picture picture)
range
- picture
- public static Chart addChart(Range range, Chart.Type type, Chart.Grouping grouping, Chart.LegendPosition pos)
range
- the range to add chartdata
- the chart datatype
- the chart typegrouping
- the grouping typepos
- the legend position typepublic static Chart addChart(Range range, SheetAnchor anchor, Chart.Type type, Chart.Grouping grouping, Chart.LegendPosition pos)
range
- the range to add chartanchor
- the chart locationdata
- the chart datatype
- the chart typegrouping
- the grouping typepos
- the legend position typepublic static SheetAnchor toChartAnchor(Range range)
range
- the range for chart.public static void moveChart(Range range, Chart chart, int rowIndex, int columnIndex)
range
- the range that represents the sheet contains the chart to move.chart
- the chart to moverowIndex
- destination row index, 0-based.columnIndex
- destination column index, 0-based.public static void deleteChart(Range range, Chart chart)
range
- the range that represents the sheet contains the chart to delete.chart
- the chart to delete.public static boolean hasChart(Range range, Chart chart)
range
- chart
- public static void protectSheet(Range range, String password, boolean allowSelectingLockedCells, boolean allowSelectingUnlockedCells, boolean allowFormattingCells, boolean allowFormattingColumns, boolean allowFormattingRows, boolean allowInsertColumns, boolean allowInsertRows, boolean allowInsertingHyperlinks, boolean allowDeletingColumns, boolean allowDeletingRows, boolean allowSorting, boolean allowFiltering, boolean allowUsingPivotTables, boolean drawingObjects, boolean scenarios)
public static void displaySheetGridlines(Range range, boolean enable)
range
- the range to be appliedenable
- true for enablepublic static void addSheet(Range range, String prefix)
range
- the range to be appliedprefix
- the sheet name prefix, it will selection a new name with this prefix and a counter.public static void createSheet(Range range, String name)
range
- the range to be appliedname
- the sheet name, it must not same as another sheet name in this bookpublic static void renameSheet(Range range, String newname)
range
- the range to be appliednewname
- the new name of the sheet, it must not same as another sheet name in this bookpublic static void setSheetOrder(Range range, int pos)
range
- the range to be appliedpos
- the sheet positionpublic static void deleteSheet(Range range)
range
- the range to be appliedpublic static void CopySheet(Range range)
range
- the range to be appliedpublic static SheetAnchor toFilledAnchor(Sheet sheet, int row, int column, int widthPx, int heightPx)
SheetAnchor
based on a cell and a picture width and heightsheet
- target sheet where the anchor locatesrow
- 0-based row indexcolumn
- 0-base column indexwidthPx
- a picture's width in pixelheightPx
- a picture's height in pixelSheetAnchor
Copyright © 2020. All rights reserved.