Click here to Skip to main content
15,886,362 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a problem that I hope someone can assist me in. I have XML stored in a database and I need to render it on a report that is a word document (docx). All I can find in the run properties of open xml is Text. Does anyone know how to display xml through open xml?

Thanks
Jerry
Posted
Comments
Sergey Alexandrovich Kryukov 14-Feb-13 13:43pm    
I don't see a problem. You just need to load this document as docx in Word application. Your docx documents use Open XML format, that's all. What's the problem? Do you use Microsoft.Office.Interop? How would you normally load a document in Word? Or you need to display it in some other ways, not in Word?
—SA
Member 9810595 14-Feb-13 15:29pm    
Sergey,
I am not using Microsoft.Office.Interop as I do not want to be dependant on word. When open xml adds the xml to the doc then it is added as a text instead of xml. When I open word, I see all of the xml tags. Any thoughts?????
Member 9810595 14-Feb-13 15:30pm    
if you want I can send you a code snippit.
Sergey Alexandrovich Kryukov 14-Feb-13 15:40pm    
At this moment, better look at my answer and see if some of my past answers are applicable to your code. They should be, because I refer to the standard and some cross-platform open-source projects working with those documents.

If you still want to discuss those possibilities, first tag your platform and language and only then provide some further detail; don't forget to explain your ultimate goals.
—SA
Sergey Alexandrovich Kryukov 14-Feb-13 16:30pm    
Or, I see. As you use C#, maybe Solution 2 could be the best, but I never tried it. Look at it first...
—SA

To start with, please see my past answers. Some part of them is devote to the cases when you want to work with Office documents directly. I did not do it (why?), but I know where to get some code. Please see:
Convert Office-Documents to PDF without interop[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

—SA
 
Share this answer
 
Comments
Maciej Los 14-Feb-13 15:54pm    
Very good answer, as always. +5!
Sergey Alexandrovich Kryukov 14-Feb-13 16:21pm    
Thank you very much, Maciej. "As always" is a huge exaggeration though :-)
—SA
Espen Harlinn 14-Feb-13 15:58pm    
Nice links :-D
Sergey Alexandrovich Kryukov 14-Feb-13 16:21pm    
Thank you, Espen.
—SA
You could try to use NPOI[^], it's a port of Apache POI to .Net.

Best regards
Espen Harlinn
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 14-Feb-13 16:23pm    
Interesting thing; I never heard of it. My 5. As I can see, this is a port, so it must be pure .NET, which is very good.
The only problem that OP still did not share what platform/language are to be used.
—SA
Espen Harlinn 14-Feb-13 16:25pm    
Thank you Sergey :-D
>> The only problem that OP still did not share what platform/language are to be used.
It says c# 4.0 up at the top, so we can make an educated guess :-D
Sergey Alexandrovich Kryukov 14-Feb-13 16:29pm    
Oh, I missed it; thank you. Then your solution must be the very best option. Did you try it?
—SA
Espen Harlinn 14-Feb-13 16:31pm    
I've worked with the Apache java version, which worked well enough ...
Sergey Alexandrovich Kryukov 14-Feb-13 16:41pm    
Good to know, I'll bookmark it. Thank you for sharing.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900