本文整理了Java中org.apache.poi.xwpf.usermodel.XWPFStyles.setStyles()
方法的一些代码示例,展示了XWPFStyles.setStyles()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XWPFStyles.setStyles()
方法的具体详情如下:
包路径:org.apache.poi.xwpf.usermodel.XWPFStyles
类名称:XWPFStyles
方法名:setStyles
[英]Sets the ctStyles
[中]设置CTS样式
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Creates an empty styles for the document if one does not already exist
*
* @return styles
*/
public XWPFStyles createStyles() {
if (styles == null) {
StylesDocument stylesDoc = StylesDocument.Factory.newInstance();
XWPFRelation relation = XWPFRelation.STYLES;
int i = getRelationIndex(relation);
XWPFStyles wrapper = (XWPFStyles) createRelationship(relation, XWPFFactory.getInstance(), i);
wrapper.setStyles(stylesDoc.addNewStyles());
styles = wrapper;
}
return styles;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Read document
*/
@Override
protected void onDocumentRead() throws IOException {
StylesDocument stylesDoc;
InputStream is = getPackagePart().getInputStream();
try {
stylesDoc = StylesDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
setStyles(stylesDoc.getStyles());
latentStyles = new XWPFLatentStyles(ctStyles.getLatentStyles(), this);
} catch (XmlException e) {
throw new POIXMLException("Unable to read styles", e);
} finally {
is.close();
}
}
代码示例来源:origin: stackoverflow.com
XWPFDocument document = new XWPFDocument();
XWPFDocument template = new XWPFDocument(new FileInputStream(new File("Template.dotx")));
XWPFStyles newStyles = document.createStyles();
newStyles.setStyles(template.getStyle());
代码示例来源:origin: stackoverflow.com
XWPFDocument template = new XWPFDocument(new FileInputStream(new File("Template.dotx")));
XWPFDocument doc = new XWPFDocument();
// let's copy styles from template to new doc
XWPFStyles newStyles = doc.createStyles();
newStyles.setStyles(template.getStyle());
XWPFParagraph para = doc.createParagraph();
para.setStyle("Heading1");
XWPFRun run = para.createRun();
run.setText("Heading 1");
return doc;
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Creates an empty styles for the document if one does not already exist
*
* @return styles
*/
public XWPFStyles createStyles() {
if (styles == null) {
StylesDocument stylesDoc = StylesDocument.Factory.newInstance();
XWPFRelation relation = XWPFRelation.STYLES;
int i = getRelationIndex(relation);
XWPFStyles wrapper = (XWPFStyles) createRelationship(relation, XWPFFactory.getInstance(), i);
wrapper.setStyles(stylesDoc.addNewStyles());
styles = wrapper;
}
return styles;
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Creates an empty styles for the document if one does not already exist
* @return styles
*/
public XWPFStyles createStyles() {
if(styles == null) {
StylesDocument stylesDoc = StylesDocument.Factory.newInstance();
XWPFRelation relation = XWPFRelation.STYLES;
int i = getRelationIndex(relation);
XWPFStyles wrapper = (XWPFStyles)createRelationship(relation, XWPFFactory.getInstance(), i);
wrapper.setStyles(stylesDoc.addNewStyles());
styles = wrapper;
}
return styles;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Read document
*/
@Override
protected void onDocumentRead() throws IOException {
StylesDocument stylesDoc;
InputStream is = getPackagePart().getInputStream();
try {
stylesDoc = StylesDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
setStyles(stylesDoc.getStyles());
latentStyles = new XWPFLatentStyles(ctStyles.getLatentStyles(), this);
} catch (XmlException e) {
throw new POIXMLException("Unable to read styles", e);
} finally {
is.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!