Decode HTML in word document

J

Jignesh D. Patel

Hello

I have created word document in C#.Net using
Microsoft.Office.Interop.Word.

I have used some functionality of Microsoft.Office.Interop.Word for
display header,Footer,Page number etc...

Generated Word document contain html code so i need to decode it.

If I use below format than html is decoded but other functionality
is not working like header,Footer,Page number.

object o_format =
Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatEncodedText;

If i use below format than header,Footer,Page number is working but
html is not decoded.

object o_format =
Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument;

How i will do for decode the html and use word functionality also.

Please give me reply.
 
T

Tony Jollans

It is not entirely clear what you are trying to do. Page headers and footers
do not make sense with HTML. Which do you want?
 
J

Jignesh D. Patel

Hello

I have created word document in C#.Net.I used
Microsoft.Office.Interop.Word.dll for create word document.
I have one web page it have Fck Editor and one button.
I have type some text in Fck Editor and do some formatting like
Bold,Italic,Back ground color,Upload Image.When i press the submit button
than word document will be generate.Word document have dynamic header,footer
and page number.
But when i open the word document than it display me html tag syntax.
like i i put text in Fck Editor is "This is my test" and i have bold it.

Than it shows me "<strong>This is my test</strong>"

So i need to display remove html tag.and display same format which i have
done in Fck Editor

How i will do.

If u have confusion in my problem than reply me.
 
T

Tony Jollans

This is a forum for VBA questions. I do not know C# so can't help directly
there, but ...

... Background colour, uploaded images, Submit buttons, all suggest you are
creating a web page. Word is not the tool for creating web pages (I know
Word can do it but it is very bad at it); if you want to create a web page
use something other than Word.

If you really are creating a Word document, then what are you opening it
with that shows the html tags? Word will not display Word documents like
that so either you are not creating with Word, or you are not opening with
Word.

And what is Fck Editor?
 
P

Paul Shapiro

If you want to have Word document features like headers and footers, then
you have to save it as a Word document and not as an html file. No choice
there I think.

I've written Word VBA code to insert html-formatted text into a Word
document, and never found a completely good way to go about it. The most
reliable approaches I found were:
a) Save the html text to a file with the .html exension and then use Word's
InsertFile method.
b) Copy the html to the clipboard, in the very particular html clipboard
format, and then Paste into the document. This is what I ended up using
because saving the html to a file seemed so stupid, and slow (although I
didn't compare performance).

I spent a long time hunting for the .InsertHTML method, because I couldn't
believe it didn't exist by now. But as far as I can tell it does not exist
so the above two options were the best I could do.
 
J

Jignesh D. Patel

Hi Paul

How r u?

Thanks for reply.

I need your help. So please give me your yahoo or gmail id we will chat and
discuss my problem.

Thanks in advance.

Please give me reply.
 
P

Paul Shapiro

The code is too long to post here, but if you email me (after making the
'obvious' anti-spam correction to my email address), I'll send you the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top