Redian新闻
>
Office 2007 Office Open XML Format New Line
avatar
Office 2007 Office Open XML Format New Line# DotNet - 窗口里的风景
s*e
1
芝加哥,一片生硬的湖水
我们于傍晚到达
地铁里的风穿身而过
同时我听到鱼群
回身时发出的浪花
这注定不是
一场预先计划的旅行
我们在水面停留一夜
第二天
整个城市都在雨水之下
长长的夜里
我们无法转身
如同高速路上并行交错的车灯
我们相遇又旋即分离
avatar
z*a
2
Hi,
I am fixing a bug in an app that builds a Word 2007 document using
Office Open XML format. There is already a .zip package for the
document. The App will build an XML formatted data which then is
imported by the document.
In the document there is one field for a street address and there is a
corresponding XML node with address data containing street address line
1 and 2. (City, State, zip is in another field so they do not matter).
I need to split the address into two lines if second line address
exists. Such as:
123 Main St.
Apt. A
The app is written using C#. I inserted \r and \n between two address
lines when the XML is built. XML looks fine but when the word document
is built and opened, the address is still in one line. Why \r \n are not
working? How to fix that?
Also, I tried \t and \t is preserved in word document.
And I tried XML special characters and but they don't work.
Thanks for your help.
avatar
s*m
4
the word document is made already. there is one field for street address
line 1 & 2 in the word form document. So the string is concatenated from two
database field values. I suggested to have two fields for line 1 and 2. but
my suggestion was turned down.
I am new to Office Open XML so I don't know why \r and \n format get lost
when word document imports the stream, but \t is preserved.

specify,

【在 s***o 的大作中提到】
: Can you just "Split" the string with "\n" or whatever delimiter you specify,
: then process the resulting strings as separate lines?
: There is also a CarriageReturn class that may be useful:
: http://msdn.microsoft.com/en-us/library/documentformat.openxml.

avatar
s*o
5
Is it based on the VS Office template, or is it created with OpenXml
APIs from scratch? In either way, if you have control to the generated
xml, then you can always parse the string and express it "correctly".
I don't know much about OpenXML either plus it's all about Excel. You
can post your question on the openxml forum:
http://openxmldeveloper.org/forums/default.aspx

address
from two
2. but
lost

【在 s**m 的大作中提到】
: the word document is made already. there is one field for street address
: line 1 & 2 in the word form document. So the string is concatenated from two
: database field values. I suggested to have two fields for line 1 and 2. but
: my suggestion was turned down.
: I am new to Office Open XML so I don't know why \r and \n format get lost
: when word document imports the stream, but \t is preserved.
:
: specify,

avatar
c*t
6
Rename your .docx file to .zip, use 7zip to open the archive, find xml spot
which has correct line-break, see what's there. You can then change your
code.

【在 z***a 的大作中提到】
: Hi,
: I am fixing a bug in an app that builds a Word 2007 document using
: Office Open XML format. There is already a .zip package for the
: document. The App will build an XML formatted data which then is
: imported by the document.
: In the document there is one field for a street address and there is a
: corresponding XML node with address data containing street address line
: 1 and 2. (City, State, zip is in another field so they do not matter).
: I need to split the address into two lines if second line address
: exists. Such as:

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。