Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: XML Office C#4.0
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 14-Feb-13 2:33am
Comments
Sergey Alexandrovich Kryukov at 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 at 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 at 14-Feb-13 15:30pm
   
if you want I can send you a code snippit.
Sergey Alexandrovich Kryukov at 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 at 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
Sergey Alexandrovich Kryukov at 14-Feb-13 15:35pm
   
OK, I perfectly understand it. Yes, you can render the Open XML, but it will be a considerable work. What is your platform? application type or UI library? Language?
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Comments
Maciej Los at 14-Feb-13 15:54pm
   
Very good answer, as always. +5!
Sergey Alexandrovich Kryukov at 14-Feb-13 16:21pm
   
Thank you very much, Maciej. "As always" is a huge exaggeration though :-)
—SA
Espen Harlinn at 14-Feb-13 15:58pm
   
Nice links :-D
Sergey Alexandrovich Kryukov at 14-Feb-13 16:21pm
   
Thank you, Espen.
—SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You could try to use NPOI[^], it's a port of Apache POI to .Net.
 
Best regards
Espen Harlinn
  Permalink  
Comments
Sergey Alexandrovich Kryukov at 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 at 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 at 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 at 14-Feb-13 16:31pm
   
I've worked with the Apache java version, which worked well enough ...
Sergey Alexandrovich Kryukov at 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)

  Print Answers RSS
0 OriginalGriff 190
1 PIEBALDconsult 150
2 BillWoodruff 148
3 DamithSL 140
4 Jochen Arndt 125
0 OriginalGriff 5,695
1 DamithSL 4,506
2 Maciej Los 4,007
3 Kornfeld Eliyahu Peter 3,480
4 Sergey Alexandrovich Kryukov 3,190


Advertise | Privacy | Mobile
Web04 | 2.8.141216.1 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100