Comments (5)
@jeremyliu17 图片或表格阳离子作为简单文本和带有适当标签的 SEQ 字段插入。 所以你可以使用这样的代码:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.write("Table ");
builder.insertField("SEQ Table");
doc.save("C:\\Temp\\out.docx");
from aspose.words-for-java.
@jeremyliu17 图片或表格阳离子作为简单文本和带有适当标签的 SEQ 字段插入。 所以你可以使用这样的代码:
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.write("Table "); builder.insertField("SEQ Table"); doc.save("C:\\Temp\\out.docx");
非常感谢,这样能够生成表1,表2...连续的序列,如果想生成这种形式表1-1,表1-2,第一个1表示跟随章节标题去变化,第二个数字为表的顺序,这种有好的办法解决吗
from aspose.words-for-java.
@jeremyliu17 如果可能的话,您能否使用 MS Word 创建预期的输出并附在此处供我们参考? 通过截图很难看出文档中使用了哪些字段。
from aspose.words-for-java.
@jeremyliu17 如果可能的话,您能否使用 MS Word 创建预期的输出并附在此处供我们参考? 通过截图很难看出文档中使用了哪些字段。
期望输出.docx
最终想生成一个这样的文档,不同测试类型的标题,和里面的表标题及表内容,希望实现的效果,我加在文档批注中了,希望得到您的回复
from aspose.words-for-java.
@jeremyliu17 感谢您提供更多信息。 在表格标题中有“STYLEREF”和“SEQ”字段:
因此,您应该插入两者以获得所需的输出:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
doc.getStyles().getByStyleIdentifier(StyleIdentifier.HEADING_1).getListFormat().applyNumberDefault();
builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.HEADING_1);
builder.writeln("This is some styled paragraph");
builder.getParagraphFormat().clearFormatting();
builder.write("Table ");
builder.insertField("STYLEREF \"Heading 1\" \\s");
builder.write("-");
builder.insertField("SEQ Table");
builder.write(" Some table caption");
doc.save("C:\\Temp\\out.docx");
from aspose.words-for-java.
Related Issues (20)
- 如何在手机上使用? HOT 1
- how to show all content of page by structure from top to bottom HOT 1
- Error in compressed image example on official website HOT 3
- All tests for table in LINQ_Reporting_Engine failed HOT 3
- 怎么更改生成的折线图的线的颜色? HOT 3
- How to generate a single image from multiple pages of a document HOT 1
- Insert html to Word,html forrmat is HOT 9
- Aspose.word function is missing HOT 9
- @SnowflyW Unfortunately, your request is not quite clear. Could you please elaborate your requirements in more details and attach your input document, sample data and the expected output? We will investigate and provide you more information.
- Invalid paragraph spacing setting HOT 2
- Typo Contents_managment HOT 1
- Missing text when convert word to pdf HOT 1
- word生成pdf时,段落中间若有——或短横线-,符号后会莫名加一个换行符 HOT 6
- fonts overlap using aspose HOT 1
- word添加水印后页眉变高 HOT 10
- word转pdf后行距增加 HOT 2
- reporting engine how to fill in content controls HOT 1
- 如何在指定页面渲染目录 HOT 1
- the overlapping of labels and values for pie charts HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aspose.words-for-java.