本文整理汇总了Java中org.odftoolkit.odfdom.incubator.doc.style.OdfStyle.getStyleNameAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java OdfStyle.getStyleNameAttribute方法的具体用法?Java OdfStyle.getStyleNameAttribute怎么用?Java OdfStyle.getStyleNameAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.odftoolkit.odfdom.incubator.doc.style.OdfStyle
的用法示例。
在下文中一共展示了OdfStyle.getStyleNameAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUpCoreStyle
import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入方法依赖的package包/类
private void setUpCoreStyle() throws Throwable {
OdfOfficeAutomaticStyles styles = doc.getContentDom().getOrCreateAutomaticStyles();
OdfStyle style = styles.newStyle(OdfStyleFamily.TableCell);
style.setProperty(OdfTableCellProperties.Border, "0.035cm solid #000000");
style.setProperty(OdfTableCellProperties.WrapOption, "wrap");
style.setProperty(OdfTableCellProperties.BackgroundColor, "#ffffff");
style.setProperty(OdfTableCellProperties.VerticalAlign, "middle");
style.setProperty(OdfParagraphProperties.TextAlign, "left");
style.setProperty(OdfParagraphProperties.MarginBottom, "0.2cm");
style.setProperty(OdfParagraphProperties.MarginTop, "0.2cm");
style.setProperty(OdfTableCellProperties.PaddingTop, "0.2cm");
style.setProperty(OdfTableCellProperties.PaddingBottom, "0.2cm");
style.setProperty(OdfTableCellProperties.PaddingLeft, "0.2cm");
style.setProperty(OdfTextProperties.FontWeight, "Regular");
style.setProperty(OdfTextProperties.FontSize, "10pt");
coreCellStyle = style.getStyleNameAttribute();
}
示例2: writeAutoStyles
import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入方法依赖的package包/类
private void writeAutoStyles() throws XMLStreamException {
StylesData sd = styles.elementAt(0);
//put together the styles use and the auto names
ArrayNode autoStylesArrary = null;
ObjectNode autoStylesObj = null;
Integer autoStylesHits = 0;
Iterable<OdfStyle> it = sd.getAutoStyles();
for (OdfStyle autoStyle :it) {
if (autoStylesArrary == null) {
autoStylesObj = rootArray.addObject();
autoStylesObj.put("name", "Automatic Styles");
autoStylesArrary = autoStylesObj.putArray(HIDDEN_CHILDREN_TAG);
}
ObjectNode autoStyleObj = autoStylesArrary.addObject();
String autoName = autoStyle.getStyleNameAttribute();
String displayStyle = autoStyle.getAttribute("style:parent-style-name");
displayStyle = autoName + " - from " + displayStyle;
String autoListStyle = autoStyle.getAttribute("style:list-style-name");
if(autoListStyle.length() > 0) {
displayStyle += " list style : " + autoListStyle;
}
autoStyleObj.put("name", displayStyle + " - ");
//was it hit?
List<Integer> hitList = new ArrayList<Integer>();
Integer totalHits = 0;
for (StylesData sdata : styles) {
Integer hits = sdata.getStylesUsed().get(autoName);
if (hits != null) {
hitList.add(hits);
totalHits += hits;
} else {
hitList.add(0);
}
}
if (totalHits > 0) {
ArrayNode hitsArray = autoStyleObj.putArray("hits");
for (Integer hit : hitList) {
hitsArray.add(hit);
}
autoStylesHits += totalHits;
}
int objNdx = 0;
ArrayNode detailsArray = autoStyleObj.putArray(HIDDEN_CHILDREN_TAG);
ObjectNode familyObj = detailsArray.addObject();
objNdx++;
familyObj.put("name", "family");
familyObj.put("value", autoStyle.getFamilyName());
ObjectNode parentObj = detailsArray.addObject();
objNdx++;
parentObj.put("name", "parent");
parentObj.put("value", autoStyle.getStyleParentStyleNameAttribute());
String listStyle = autoStyle.getStyleListStyleNameAttribute();
if(listStyle != null) {
ObjectNode listStlyeObj = detailsArray.addObject();
objNdx++;
listStlyeObj.put("name", "list style");
listStlyeObj.put("value", autoStyle.getStyleListStyleNameAttribute());
}
ObjectNode propsObj= detailsArray.addObject();
objNdx++;
propsObj.put("name", "properties");
ArrayNode propsArray = propsObj.putArray(HIDDEN_CHILDREN_TAG);
int propSets = writePropertySets(propsArray, autoStyle);
if(propSets == 0) {
detailsArray.remove(objNdx - 1);
}
}
if (autoStylesObj != null && autoStylesHits > 0) {
autoStylesObj.put("totalHits", autoStylesHits);
}
}
示例3: prepareCoreStyle
import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入方法依赖的package包/类
public static String prepareCoreStyle(final SpreadsheetDocument doc) throws Throwable {
OdfOfficeAutomaticStyles styles = doc.getContentDom().getOrCreateAutomaticStyles();
OdfStyle style = styles.newStyle(OdfStyleFamily.TableCell);
for (OdfStyleProperty property : styleMap.keySet()) {
style.setProperty(property, styleMap.get(property));
}
coreStyleName = style.getStyleNameAttribute();
return coreStyleName;
}
示例4: addAutomaticStyles
import org.odftoolkit.odfdom.incubator.doc.style.OdfStyle; //导入方法依赖的package包/类
void addAutomaticStyles() {
OdfStyle style;
// Column style (all columns same width)
style = contentAutoStyles.newStyle(OdfStyleFamily.TableColumn);
columnStyleName = style.getStyleNameAttribute();
style.setProperty(OdfTableColumnProperties.ColumnWidth, "2.5cm");
// Row style
style = contentAutoStyles.newStyle(OdfStyleFamily.TableRow);
rowStyleName = style.getStyleNameAttribute();
style.setProperty(OdfTableRowProperties.RowHeight, "0.5cm");
// bold centered cells (for first row)
style = contentAutoStyles.newStyle(OdfStyleFamily.TableCell);
headingStyleName = style.getStyleNameAttribute();
style.setProperty(OdfParagraphProperties.TextAlign, "center");
setFontWeight(style, "bold");
// Create the date, time, and temperature styles and add them.
// The null in OdfNumberDateStyle means "use default calendar system"
OdfNumberDateStyle dateStyle = new OdfNumberDateStyle(contentDom, "yyyy-MM-dd", "numberDateStyle", null);
OdfNumberTimeStyle timeStyle = new OdfNumberTimeStyle(contentDom, "hh:mm:ss", "numberTimeStyle");
OdfNumberStyle numberStyle = new OdfNumberStyle(contentDom, "#0.00", "numberTemperatureStyle");
contentAutoStyles.appendChild(dateStyle);
contentAutoStyles.appendChild(timeStyle);
contentAutoStyles.appendChild(numberStyle);
// cell style for Date cells
style = contentAutoStyles.newStyle(OdfStyleFamily.TableCell);
noaaDateStyleName = style.getStyleNameAttribute();
style.setStyleDataStyleNameAttribute("numberDateStyle");
// and for time cells
style = contentAutoStyles.newStyle(OdfStyleFamily.TableCell);
noaaTimeStyleName = style.getStyleNameAttribute();
style.setStyleDataStyleNameAttribute("numberTimeStyle");
// and for the temperatures
style = contentAutoStyles.newStyle(OdfStyleFamily.TableCell);
noaaTempStyleName = style.getStyleNameAttribute();
style.setStyleDataStyleNameAttribute("numberTemperatureStyle");
style.setProperty(OdfParagraphProperties.TextAlign, "right");
}