org.simpleods
public class TableStyle extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
ALIGN_CENTER |
static int |
ALIGN_JUSTIFY |
static int |
ALIGN_LEFT |
static int |
ALIGN_RIGHT |
static int |
STYLE_TABLE |
static int |
STYLE_TABLECELL |
static int |
STYLE_TABLECOLUMN |
static int |
STYLE_TABLEROW |
static int |
VERTICALALIGN_BOTTOM |
static int |
VERTICALALIGN_MIDDLE |
static int |
VERTICALALIGN_TOP |
Constructor and Description |
---|
TableStyle(int nFamily,
java.lang.String sStyleName,
OdsFile odsFile)
Create a new table style and add it to content.
|
Modifier and Type | Method and Description |
---|---|
void |
addBorderStyle(BorderStyle bs)
Add a border style to this cell.
|
void |
addBorderStyle(java.lang.String sSize,
java.lang.String sBorderColor,
int nStyle,
int nPosition)
Add a border style to this cell.
|
java.lang.String |
getDefaultCellStyle() |
java.lang.String |
getFontSize()
Get the font size as string, e.g. '10.5pt' or '8pt'
|
int |
getFontUnderline() |
java.lang.String |
getName()
Get the name of this table style.
|
int |
getStyleType()
Get the style type of this TableStyle, this is either:
TableStyle.STYLE_TABLE, TableStyle.STYLE_TABLECOLUMN ,TableStyle.STYLE_TABLEROW or TableStyle.STYLE_TABLECELL. |
TextStyle |
getTextStyle()
Get the current TextStyle object.
|
boolean |
resetFontWrap()
Deprecated.
- Use setFontWrap(false)
|
boolean |
resetTextAlign()
Reset any text alignment.
|
boolean |
resetVerticalAlign()
Reset any vertical text alignment.
|
boolean |
setBackgroundColor(java.lang.String sColor)
Set the cell background color to sColor.
|
boolean |
setColumnWidth(java.lang.String sWidth)
Set the column width of a table column.
|
void |
setDataStyle(CurrencyStyle cs)
Set the data style for this TableStyle to cs.
|
void |
setDataStyle(DateStyle ds)
Set the data style for this TableStyle to ds.
|
void |
setDataStyle(NumberStyle ns)
Set the data style for this TableStyle to ns.
|
boolean |
setDefaultCellStyle(TableStyle ts)
Set the default cell style of a table column.
|
boolean |
setFontColor(java.lang.String sColor)
Set the font color to sColor.
|
void |
setFontSize(int fontSize)
Set the font size in points to the given value.
|
void |
setFontSize(java.lang.String fontSize)
Set the font size to the given value
fontSize is a length value expressed as a number followed by pt, e.g. 12pt |
void |
setFontUnderline(int nUnderlineStyle)
Set the style that should be used for the underline.
|
boolean |
setFontWeightBold()
Set the font weight to bold.
|
boolean |
setFontWeightItalic()
Set the font weight to italic.
|
boolean |
setFontWeightNormal()
Set the font weight to normal.
|
boolean |
setFontWrap()
Deprecated.
- Use setFontWrap(true)
|
boolean |
setFontWrap(boolean fSetWrap)
Set font wrap.
|
boolean |
setRowHeight(java.lang.String sHeight)
Set the row height to a table row.
|
boolean |
setTextAlign(int nAlign)
Set the alignment of text.
|
void |
setTextStyle(TextStyle textStyle)
Set a new TextStyle object.
|
boolean |
setVerticalAlign(int nAlign)
Set the vertical alignment of text.
|
public static final int STYLE_TABLE
public static final int STYLE_TABLECOLUMN
public static final int STYLE_TABLEROW
public static final int STYLE_TABLECELL
public static final int VERTICALALIGN_TOP
public static final int VERTICALALIGN_MIDDLE
public static final int VERTICALALIGN_BOTTOM
public static final int ALIGN_LEFT
public static final int ALIGN_CENTER
public static final int ALIGN_RIGHT
public static final int ALIGN_JUSTIFY
public TableStyle(int nFamily, java.lang.String sStyleName, OdsFile odsFile)
nFamily
- The type of this style, either
STYLE_TABLECOLUMN,STYLE_TABLEROW,STYLE_TABLE or
STYLE_TABLECELLsStyleName
- A unique name for this styleodsFile
- The OdsFile to add this style topublic java.lang.String getName()
public int getStyleType()
public java.lang.String getDefaultCellStyle()
public boolean setColumnWidth(java.lang.String sWidth)
sWidth
- - The width of a column, e.g. '10cm'public boolean setDefaultCellStyle(TableStyle ts)
ts
- The table cell style to be used as defaultpublic boolean setRowHeight(java.lang.String sHeight)
sHeight
- The table row height to be used, e.g. '1.0cm'public boolean setBackgroundColor(java.lang.String sColor)
sColor
- - The color to be used in format #rrggbb e.g. #ff0000 for a
red cell backgroundpublic boolean setFontColor(java.lang.String sColor)
sColor
- The color to be used in format #rrggbb e.g. #ff0000 for a red
cell backgroundpublic boolean setFontWeightItalic()
public boolean setFontWeightBold()
public boolean setFontWeightNormal()
public java.lang.String getFontSize()
public void setFontSize(java.lang.String fontSize)
fontSize
- - The font size as string, e.g. '10.5pt' or '8pt'public void setFontSize(int fontSize)
fontSize
- - The font size as int , e.g. 10 or 8public boolean setFontWrap(boolean fSetWrap)
fSetWrap
- public boolean setFontWrap()
public boolean resetFontWrap()
public boolean setTextAlign(int nAlign)
nAlign
- - The text alignment flag,public boolean resetTextAlign()
public boolean setVerticalAlign(int nAlign)
nAlign
- - The vertical alignment flag,public boolean resetVerticalAlign()
public void addBorderStyle(java.lang.String sSize, java.lang.String sBorderColor, int nStyle, int nPosition)
sSize
- The size of the line e.g. '0.1cm'sBorderColor
- - The color to be used in format #rrggbb e.g. '#ff0000' for a
red bordernStyle
- - The style of the border line, either
BorderStyle.BORDER_SOLID or BorderStyle.BORDER_DOUBLEnPosition
- - The position of the line in this cell, e.g.
BorderStyle.POSITION_TOPpublic void addBorderStyle(BorderStyle bs)
bs
- - The border style to be usedpublic void setDataStyle(NumberStyle ns) throws SimpleOdsException
ns
- The number style to be usedSimpleOdsException
- Thrown if the style type of ns is not
TableStyle.STYLE_TABLECELLpublic void setDataStyle(CurrencyStyle cs) throws SimpleOdsException
cs
- The currency style to be usedSimpleOdsException
- Thrown if the style type of cs is not
TableStyle.STYLE_TABLECELLpublic void setDataStyle(DateStyle ds) throws SimpleOdsException
ds
- The date style to be usedSimpleOdsException
- Thrown if the style type of ds is not TableStyle.STYLE_TABLECELLpublic int getFontUnderline()
public void setFontUnderline(int nUnderlineStyle)
nUnderlineStyle
- The underline stlyepublic TextStyle getTextStyle()
public void setTextStyle(TextStyle textStyle)
textStyle
- The new text style to be used