How to convert Word to XML in c#? [Resolved]

Posted by Gudevg under C# on 4/21/2012 | Points: 10 | Views : 10926 | Status : [Member] | Replies : 12
Hi folks,

I need to convert all word document into xml file. How is it possible to convert without using any tool?


Regards,
Deepak G.

Deepakkumar G.


Responses

Posted by: Sakthi.Singaravel on: 4/21/2012 [Member] Silver | Points: 50

Up
0
Down

Resolved
String Whole_Data= File.ReadAllText("Input.doc", System.Text.Encoding.Default);




Regards,
Singaravel M

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/21/2012 [Member] Silver | Points: 25

Up
0
Down
That word file contains data only or with xml tags....

Regards,
Singaravel M

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gudevg on: 4/21/2012 [Member] Starter | Points: 25

Up
0
Down
It contains with xml tags.

Deepakkumar G.

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/21/2012 [Member] Silver | Points: 25

Up
0
Down
first read doc file into string...

Dim Whole_Data As String = File.ReadAllText("Input.doc", System.Text.Encoding.Default)


write file to xml...

File.WriteAllText("Output.xml", Whole_Data )


The above code is VB .Net

Regards,
Singaravel M

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gudevg on: 4/21/2012 [Member] Starter | Points: 25

Up
0
Down
Okay.


Regards,
Deepak G.

Deepakkumar G.

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gudevg on: 4/21/2012 [Member] Starter | Points: 25

Up
0
Down
How do i declare this in c#?

Dim Whole_Data As String = File.ReadAllText("Input.doc", System.Text.Encoding.Default)


Deepakkumar G.

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/21/2012 [Member] Silver | Points: 25

Up
0
Down
@gudevg
sorry for the delay...

Regards,
Singaravel M

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gudevg on: 4/21/2012 [Member] Starter | Points: 25

Up
0
Down
No problem... Thank you for this help.

Deepakkumar G.

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/21/2012 [Member] Silver | Points: 25

Up
0
Down
u r welcome...

Regards,
Singaravel M

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Hariinakoti on: 4/21/2012 [Member] Starter | Points: 25

Up
0
Down
Thank you sakthi...

Regards
Hari

Thanks & Regards
Hari

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 4/21/2012 [Member] Silver | Points: 25

Up
0
Down
@Hari

Welcome

Regards,
Singaravel M

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Prasath on: 9/10/2012 [Member] Starter | Points: 25

Up
0
Down
Hi

I tried to convert word document to xml files .
I tried with the codes mentioned below.
The document was converted but the converted file doesnt contain any data.

here is the code i tried.

String Whole_Data = File.ReadAllText("D:\\upload\\Welcome.docx", System.Text.Encoding.Default);
File.WriteAllText("D:\\examplexsd\\Output.xml", Whole_Data);

Gudevg, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response