Click here to Skip to main content
13,198,325 members (64,688 online)
Rate this:
Please Sign up or sign in to vote.
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?

Posted 14-Feb-13 1:33am
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?
Member 9810595 14-Feb-13 15:29pm
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.
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...
Sergey Alexandrovich Kryukov 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?
Rate this: bad
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[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

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 :-)
Espen Harlinn 14-Feb-13 15:58pm
Nice links :-D
Sergey Alexandrovich Kryukov 14-Feb-13 16:21pm
Thank you, Espen.
Rate this: bad
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
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.
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?
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.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171020.1 | Last Updated 14 Feb 2013
Copyright © CodeProject, 1999-2017
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