Modifier and Type | Class and Description |
---|---|
static interface |
CellOperationUtil.CellStyleApplier
Interface for help apply cell style
|
static interface |
CellOperationUtil.CellStyleApplierEx
Interface for help apply whole row,column style
|
Constructor and Description |
---|
CellOperationUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
applyAlignment(Range range,
CellStyle.Alignment alignment)
Apply alignment to cells in the range
|
static void |
applyBackColor(Range range,
String htmlColor)
Apply back-color to cells in the range
|
static void |
applyBackgroundColor(Range range,
String htmlColor)
Deprecated.
|
static void |
applyBorder(Range range,
Range.ApplyBorderType applyType,
CellStyle.BorderType borderType,
String htmlColor)
Apply border to cells in the range
|
static void |
applyCellStyle(Range range,
CellOperationUtil.CellStyleApplier applyer)
Apply style according to the cell style applier
|
static void |
applyDataFormat(Range range,
String format)
Apply data-format to cells in the range
|
static void |
applyFillColor(Range range,
String htmlColor)
Apply fill-color to cells in the range
|
static void |
applyFontBoldweight(Range range,
Font.Boldweight boldweight)
Apply font bold-weight to cells in the range
|
static void |
applyFontColor(Range range,
String htmlColor)
Apply font color to cells in the range
|
static void |
applyFontHeight(Range range,
int fontHeight)
Deprecated.
|
static void |
applyFontHeightPoints(Range range,
int fontHeightPoints)
Apply font height to cells in the range, it will also enlarge the row height if row height is smaller than font height
|
static void |
applyFontItalic(Range range,
boolean italic)
Apply font italic to cells in the range
|
static void |
applyFontName(Range range,
String fontName)
Apply font to cells in the range
|
static void |
applyFontSize(Range range,
int point)
Deprecated.
|
static void |
applyFontStrikeout(Range range,
boolean strikeout)
Apply font strike-out to cells in the range
|
static void |
applyFontTypeOffset(Range range,
Font.TypeOffset offset)
Apply font typeOffset to cells in the range
|
static void |
applyFontUnderline(Range range,
Font.Underline underline)
Apply font underline to cells in the range
|
static void |
applyHyperlink(Range range,
Hyperlink.HyperlinkType type,
String address,
String label) |
static void |
applyIndentionOffset(Range range,
int offset)
Apply indention to cells in the range
|
static void |
applyRotation(Range range,
int rotation)
Apply alignment to cells in the range
|
static void |
applyVerticalAlignment(Range range,
CellStyle.VerticalAlignment alignment)
Apply vertical-alignment to cells in the range
|
static void |
applyWrapText(Range range,
boolean wraptext)
Apply text-warp to cells in the range
|
static void |
autoFill(Range src,
Range dest,
Range.AutoFillType type)
Fills data from source range to destination range automatically upon auto fill type
|
static void |
clearAll(Range range)
Clear all
|
static void |
clearContents(Range range)
Clear contents
|
static void |
clearStyles(Range range)
Clear style
|
static Range |
cut(Range src,
Range dest)
Cuts data and style from src to destination
|
static void |
delete(Range range,
Range.DeleteShift shift)
Delete cells of the range.
|
static void |
deleteColumn(Range range)
Delete columns to the range.
|
static void |
deleteRow(Range range)
Delete rows of the range.
|
static void |
fitFontHeightPoints(Range range)
Detect the highest words in each row.
|
static CellOperationUtil.CellStyleApplier |
getAligmentApplier(CellStyle.Alignment alignment) |
static CellOperationUtil.CellStyleApplier |
getBackColorApplier(Color color) |
static CellOperationUtil.CellStyleApplier |
getBackgroundColorApplier(Color color)
Deprecated.
|
static CellOperationUtil.CellStyleApplier |
getDataFormatApplier(String format) |
static CellOperationUtil.CellStyleApplier |
getFillColorApplier(Color color) |
static CellOperationUtil.CellStyleApplier |
getFontBoldweightApplier(Font.Boldweight boldweight) |
static CellOperationUtil.CellStyleApplier |
getFontColorApplier(Color color) |
static CellOperationUtil.CellStyleApplier |
getFontHeightApplier(int fontHeight)
Deprecated.
|
static CellOperationUtil.CellStyleApplier |
getFontHeightPointsApplier(int fontHeightPoints) |
static CellOperationUtil.CellStyleApplier |
getFontItalicApplier(boolean italic) |
static CellOperationUtil.CellStyleApplier |
getFontNameApplier(String fontName) |
static CellOperationUtil.CellStyleApplier |
getFontStrikeoutApplier(boolean strikeout) |
static CellOperationUtil.CellStyleApplier |
getFontTypeOffsetApplier(Font.TypeOffset offset) |
static CellOperationUtil.CellStyleApplier |
getFontUnderlineApplier(Font.Underline underline) |
static CellOperationUtil.CellStyleApplier |
getIndentionApplier(int offset) |
static CellOperationUtil.CellStyleApplier |
getRichTextFontBoldweightApplier(Font.Boldweight boldweight) |
static CellOperationUtil.CellStyleApplier |
getRichTextFontColorApplier(Color color) |
static CellOperationUtil.CellStyleApplier |
getRichTextFontHeightPointsApplier(int heightPoints) |
static CellOperationUtil.CellStyleApplier |
getRichTextFontItalicApplier(boolean italic) |
static CellOperationUtil.CellStyleApplier |
getRichTextFontNameApplier(String fontName) |
static CellOperationUtil.CellStyleApplier |
getRichTextFontStrikeoutApplier(boolean strikeout) |
static CellOperationUtil.CellStyleApplier |
getRichTextFontTypeOffsetApplier(Font.TypeOffset offset) |
static CellOperationUtil.CellStyleApplier |
getRichTextFontUnderlineApplier(Font.Underline underline) |
static CellOperationUtil.CellStyleApplier |
getRotationApplier(short rotation) |
static CellOperationUtil.CellStyleApplier |
getVerticalAligmentApplier(CellStyle.VerticalAlignment alignment) |
static CellOperationUtil.CellStyleApplier |
getWrapTextApplier(boolean wraptext) |
static void |
hide(Range range)
Hide the range.
|
static void |
insert(Range range,
Range.InsertShift shift,
Range.InsertCopyOrigin copyOrigin)
Insert cells to the range.
|
static void |
insertColumn(Range range)
Insert columns to the range.
|
static void |
insertRow(Range range)
Insert rows to the range.
|
static void |
merge(Range range,
boolean across)
merge the range
|
static Range |
paste(Range src,
Range dest)
Paste data and style from src to destination
|
static Range |
pasteAllExceptBorder(Range src,
Range dest)
Paste all (except border) from src to destination
|
static Range |
pasteFormula(Range src,
Range dest)
Paste formula only from src to destination
|
static Range |
pasteSpecial(Range src,
Range dest,
Range.PasteType pasteType,
Range.PasteOperation pasteOperation,
boolean skipBlank,
boolean transpose)
Paste according the argument from src to destination
|
static Range |
pasteTranspose(Range src,
Range dest)
Paste and transpose from src to destination
|
static Range |
pasteValue(Range src,
Range dest)
Paste value only from src to destination
|
static void |
setColumnWidth(Range range,
int widthPx)
Sets the column width
|
static void |
setRowHeight(Range range,
int heightPx)
Sets the row height and make it as custom modified
|
static void |
setRowHeight(Range range,
int heightPx,
boolean isCustom)
Sets the row height and provide a custom flag, a custom flag to indicate this height was set by user or system.
|
static void |
shift(Range range,
int rowOffset,
int colOffset)
Shifts/moves cells with a offset row and column
|
static void |
sort(Range range,
boolean desc)
Sort range
|
static void |
sort(Range range,
Range index1,
boolean desc1,
Range.SortDataOption dataOption1,
Range index2,
boolean desc2,
Range.SortDataOption dataOption2,
Range index3,
boolean desc3,
Range.SortDataOption dataOption3,
boolean header,
boolean matchCase,
boolean sortByRows)
Sort range
|
static void |
toggleMergeCenter(Range range)
Toggle merge/unmerge of the range, if merging it will also set alignment to center
|
static void |
unhide(Range range)
Unhide the range.
|
static void |
unmerge(Range range)
Unmerge the range
|
public static Range cut(Range src, Range dest)
src
- source rangedest
- destination rangepublic static Range paste(Range src, Range dest)
src
- source rangedest
- destination rangepublic static Range pasteFormula(Range src, Range dest)
src
- source rangedest
- destination rangepublic static Range pasteValue(Range src, Range dest)
src
- source rangedest
- destination rangepublic static Range pasteAllExceptBorder(Range src, Range dest)
src
- source rangedest
- destination rangepublic static Range pasteTranspose(Range src, Range dest)
src
- source rangedest
- destination rangepublic static Range pasteSpecial(Range src, Range dest, Range.PasteType pasteType, Range.PasteOperation pasteOperation, boolean skipBlank, boolean transpose)
src
- source rangedest
- destination rangepasteType
- paste typepasteOperation
- paste operationskipBlank
- skip blanktranspose
- transposepublic static CellOperationUtil.CellStyleApplier getFontNameApplier(String fontName)
public static void applyFontName(Range range, String fontName)
range
- range to be appliedfontName
- the font namepublic static CellOperationUtil.CellStyleApplier getRichTextFontNameApplier(String fontName)
public static CellOperationUtil.CellStyleApplier getFontHeightApplier(int fontHeight)
applyFontHeightPoints(Range, int)
public static void applyFontHeight(Range range, int fontHeight)
applyFontHeightPoints(Range, int)
range
- range to be appliedfontHeight
- the font height in twpi (1/20 point)public static void applyFontSize(Range range, int point)
applyFontHeightPoints(Range, int)
range
- range to be appliedpoint
- the font size in pointpublic static void applyFontHeightPoints(Range range, int fontHeightPoints)
range
- range to be appliedfontHeightPoints
- the font height in pointpublic static void fitFontHeightPoints(Range range)
range
- range to be detectedpublic static CellOperationUtil.CellStyleApplier getFontHeightPointsApplier(int fontHeightPoints)
public static CellOperationUtil.CellStyleApplier getRichTextFontHeightPointsApplier(int heightPoints)
public static CellOperationUtil.CellStyleApplier getFontBoldweightApplier(Font.Boldweight boldweight)
public static void applyFontBoldweight(Range range, Font.Boldweight boldweight)
range
- the range to be appliedboldweight
- the font bold-weightpublic static CellOperationUtil.CellStyleApplier getRichTextFontBoldweightApplier(Font.Boldweight boldweight)
public static CellOperationUtil.CellStyleApplier getFontItalicApplier(boolean italic)
public static void applyFontItalic(Range range, boolean italic)
range
- the range to be applieditalic
- the font italicpublic static CellOperationUtil.CellStyleApplier getRichTextFontItalicApplier(boolean italic)
public static CellOperationUtil.CellStyleApplier getFontStrikeoutApplier(boolean strikeout)
public static void applyFontStrikeout(Range range, boolean strikeout)
range
- the range to be appliedstrikeout
- font strike-outpublic static CellOperationUtil.CellStyleApplier getRichTextFontStrikeoutApplier(boolean strikeout)
public static CellOperationUtil.CellStyleApplier getFontUnderlineApplier(Font.Underline underline)
public static void applyFontUnderline(Range range, Font.Underline underline)
range
- the range to be appliedunderline
- font underlinepublic static CellOperationUtil.CellStyleApplier getRichTextFontUnderlineApplier(Font.Underline underline)
public static CellOperationUtil.CellStyleApplier getFontColorApplier(Color color)
public static void applyFontColor(Range range, String htmlColor)
range
- the range to be applied.htmlColor
- the color by html color syntax(#rgb-hex-code, e.x #FF00FF)public static CellOperationUtil.CellStyleApplier getRichTextFontColorApplier(Color color)
public static CellOperationUtil.CellStyleApplier getBackColorApplier(Color color)
@Deprecated public static CellOperationUtil.CellStyleApplier getBackgroundColorApplier(Color color)
public static CellOperationUtil.CellStyleApplier getFillColorApplier(Color color)
@Deprecated public static void applyBackgroundColor(Range range, String htmlColor)
range
- the range to be appliedhtmlColor
- the color by html color syntax(#rgb-hex-code, e.x #FF00FF)public static void applyBackColor(Range range, String htmlColor)
range
- the range to be appliedhtmlColor
- the color by html color syntax(#rgb-hex-code, e.x #FF00FF)public static void applyFillColor(Range range, String htmlColor)
range
- the range to be appliedhtmlColor
- the color by html color syntax(#rgb-hex-code, e.x #FF00FF)public static CellOperationUtil.CellStyleApplier getDataFormatApplier(String format)
public static void applyDataFormat(Range range, String format)
range
- the range to be appliedformat
- the data formatpublic static CellOperationUtil.CellStyleApplier getAligmentApplier(CellStyle.Alignment alignment)
public static void applyAlignment(Range range, CellStyle.Alignment alignment)
range
- the range to be appliedalignment
- the alignementpublic static CellOperationUtil.CellStyleApplier getVerticalAligmentApplier(CellStyle.VerticalAlignment alignment)
public static void applyVerticalAlignment(Range range, CellStyle.VerticalAlignment alignment)
range
- the range to be appliedalignment
- vertical alignmentpublic static void applyCellStyle(Range range, CellOperationUtil.CellStyleApplier applyer)
range
- the range to be appliedapplyer
- public static void applyBorder(Range range, Range.ApplyBorderType applyType, CellStyle.BorderType borderType, String htmlColor)
range
- the range to be appliedapplyType
- the apply typeborderType
- the border typehtmlColor
- the color of border(#rgb-hex-code, e.x #FF00FF)public static void toggleMergeCenter(Range range)
range
- the range to be appliedpublic static void merge(Range range, boolean across)
range
- the range to be mergeacross
- true if merge horizontallypublic static void unmerge(Range range)
range
- the range to be unmergepublic static CellOperationUtil.CellStyleApplier getWrapTextApplier(boolean wraptext)
public static void applyWrapText(Range range, boolean wraptext)
range
- the range to be appliedwraptext
- wrap text or notpublic static void applyHyperlink(Range range, Hyperlink.HyperlinkType type, String address, String label)
public static void clearContents(Range range)
range
- the range to be cleared.public static void clearStyles(Range range)
range
- the range to be clearedpublic static void clearAll(Range range)
range
- the range to be clearedpublic static void insert(Range range, Range.InsertShift shift, Range.InsertCopyOrigin copyOrigin)
Range.toRowRange()
first, to insert a column, you have to call Range.toColumnRange()
first.range
- the range to insert new cellsshift
- the shift direction of original cellscopyOrigin
- copy the format from nearby cells when inserting new cellspublic static void insertRow(Range range)
range
- the range to insert new rowspublic static void insertColumn(Range range)
range
- the range to insert new rowspublic static void delete(Range range, Range.DeleteShift shift)
Range.toRowRange()
first, to delete a column, you have to call Range.toColumnRange()
first.range
- the range to deleteshift
- the shift direction when deleting.public static void deleteRow(Range range)
range
- the range to delete rowspublic static void deleteColumn(Range range)
range
- the range to delete columnspublic static void sort(Range range, boolean desc)
range
- the range to sortdesc
- true for descent, false for ascentpublic static void sort(Range range, Range index1, boolean desc1, Range.SortDataOption dataOption1, Range index2, boolean desc2, Range.SortDataOption dataOption2, Range index3, boolean desc3, Range.SortDataOption dataOption3, boolean header, boolean matchCase, boolean sortByRows)
range
- the range to sortdesc
- true for descent, false for ascentpublic static void hide(Range range)
Range.toRowRange()
first, to hide a column, you have to call Range.toColumnRange()
range
- the range to hidepublic static void unhide(Range range)
Range.toRowRange()
first, to unhide a column, you have to call Range.toColumnRange()
range
- the range to un-hidepublic static void shift(Range range, int rowOffset, int colOffset)
range
- the range to shiftrowOffset
- the row offsetcolOffset
- the column offsetpublic static void autoFill(Range src, Range dest, Range.AutoFillType type)
src
- the source rangedest
- the destination rangetype
- the fill type, currently only support AutoFillType.DEFAULT, AutoFillType.COPY, AutoFillType.FORMAT, AutoFillType.VALUESpublic static void setRowHeight(Range range, int heightPx)
range
- heightPx
- public static void setRowHeight(Range range, int heightPx, boolean isCustom)
range
- heightPx
- isCustom
- public static void setColumnWidth(Range range, int widthPx)
range
- widthPx
- public static CellOperationUtil.CellStyleApplier getFontTypeOffsetApplier(Font.TypeOffset offset)
public static void applyFontTypeOffset(Range range, Font.TypeOffset offset)
range
- the range to be appliedoffset
- font type offset (super, sub)public static CellOperationUtil.CellStyleApplier getRichTextFontTypeOffsetApplier(Font.TypeOffset offset)
public static CellOperationUtil.CellStyleApplier getRotationApplier(short rotation)
public static void applyRotation(Range range, int rotation)
range
- the range to be appliedint
- the rotation degree(255 means vertical text)public static CellOperationUtil.CellStyleApplier getIndentionApplier(int offset)
public static void applyIndentionOffset(Range range, int offset)
range
- the range to be appliedoffset
- the relative value to indent. Value greater than 0 means increasing indent.
On the other hand, value less than 0 means decreasing indent.Copyright © 2020. All rights reserved.