由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
DotNet版 - Office 2007 Office Open XML Format New Line
相关主题
.NET 入门系列(2)--Web Services,XML,SOAPStylecop很爽啊!
用Web Service,当client调用Server的API的时候, ASP.NET 4.0 WEB API design 的best practice
.Net Formatting Objects Processor - NFOPNdoc - .Net's javadoc
crystal report for .netRe: Application Interoperability btw .N
String::Format doesn't take integer type params[转载] 申请.NET 版
How to convert formated string to intusing weather XML feed in C# - 1
Visual Studio2005没法对js文件auto-format?using weather XML feed in C# - 2
Any easy way to create PDF on the fly?diffGram Re: using weather XML feed
相关话题的讨论汇总
话题: xml话题: office话题: document话题: address话题: line
进入DotNet版参与讨论
1 (共1页)
z***a
发帖数: 138
1
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.
s***o
发帖数: 2191
2
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.
s**m
发帖数: 1564
3
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.

s***o
发帖数: 2191
4
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,

c**t
发帖数: 2744
5
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:

1 (共1页)
进入DotNet版参与讨论
相关主题
diffGram Re: using weather XML feedString::Format doesn't take integer type params
screebshot: winform based weather appHow to convert formated string to int
web service Re: .NET 入门系列(1)--什么是.NETVisual Studio2005没法对js文件auto-format?
WSDLAny easy way to create PDF on the fly?
.NET 入门系列(2)--Web Services,XML,SOAPStylecop很爽啊!
用Web Service,当client调用Server的API的时候, ASP.NET 4.0 WEB API design 的best practice
.Net Formatting Objects Processor - NFOPNdoc - .Net's javadoc
crystal report for .netRe: Application Interoperability btw .N
相关话题的讨论汇总
话题: xml话题: office话题: document话题: address话题: line