简体   繁体   English

xsl-fo:没有为 word 文档呈现新行

[英]xsl-fo: new line not rendered for word document

I am working on a piece of code(scala) which renders documents like PDF, word etc. using XSL-FO.我正在研究一段代码(scala),它使用 XSL-FO 呈现 PDF、word 等文档。

At a point in implementation, a new line is introduced using \n.在实现的某个时刻,使用 \n 引入了一个新行。 During debugging , I see that resulting xml string is as:在调试期间,我看到生成的 xml 字符串为:

<fo:inline xmlns:fo="http://www.w3.org/1999/XSL/Format">
</fo:inline>

But this is respected only for PDFs, and for word documents no new line is introduced.但这仅适用于 PDF,对于 word 文档没有引入新行。 How to get it working for word too?如何让它也适用于单词?

White-space characters generally collapse and linefeeds are generally ignored.空白字符通常会折叠,换行符通常会被忽略。

To preserve linefeeds, add either wrap="pre" (see https://www.w3.org/TR/xsl11/#white-space ) or linefeed-treatment="preserve" (see https://www.w3.org/TR/xsl11/#linefeed-treatment ).要保留换行符,请添加wrap="pre" (请参阅https://www.w3.org/TR/xsl11/#white-space )或linefeed-treatment="preserve" (请参阅https://www.w3. org/TR/xsl11/#linefeed-treatment )。

wrap is a shorthand that sets values for linefeed-treatment , white-space-collapse , white-space-treatment , and wrap-option . wrap是一个简写,它设置linefeed-treatmentwhite-space-collapsewhite-space-treatmentwrap-option

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM