| |

VerySource

 Forgot password?
 Register
Search
View: 1436|Reply: 11

How to use C # to read word documents in ASP pages

[Copy link]

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 United States

Post time: 2020-1-24 17:00:01
| Show all posts |Read mode
How to read a word document with c # in an ASP webpage? Is there any special control, if not how to write it?
Reply

Use magic Report

1

Threads

60

Posts

37.00

Credits

Newbie

Rank: 1

Credits
37.00

 China

Post time: 2020-2-11 01:00:01
| Show all posts
If you just read the stream, it can be achieved. Open the current page to display the word. If there is interaction, you need to use the owc control.
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 Unknown

 Author| Post time: 2020-2-11 12:30:02
| Show all posts
It's garbled when read by stream
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-11 13:15:01
| Show all posts
Word.ApplicationClass word = new Word.ApplicationClass ();
word.Documents.Open (ref path, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref openformat, ref o, ref o, ref o, ref o, ref o , ref o);
Ranch
object sFileName = Server.MapPath ("aa.doc");
Ranch
word.ActiveDocument.SaveAs2000 (ref sFileName, ref saveformat, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o, ref o);
word.ActiveDocument.Close (ref o, ref o, ref o);
word.Quit (ref o, ref o, ref o);
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-11 13:30:01
| Show all posts
Components that reference word.
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-11 16:15:01
| Show all posts
The level is limited, I ca n’t read it in detail, thank you
Reply

Use magic Report

0

Threads

322

Posts

115.00

Credits

Newbie

Rank: 1

Credits
115.00

 China

Post time: 2020-2-11 17:45:02
| Show all posts
In engineering

Add-> reference-> com component, find the Microsoft word and add it.
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-2-12 14:15:01
| Show all posts
I mean to comment your code, some I don't understand, thank you
Reply

Use magic Report

0

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-3-3 21:15:02
| Show all posts
byte [] input = new byte [FileLen];
    System.IO.Stream UpLoadStream = FileUpload1.PostedFile.InputStream;
    UpLoadStream.Read (input, 0, FileLen);
    UpLoadStream.Position = 0;
    System.IO.StreamReader sr = new System.IO.StreamReader (UpLoadStream, System.Text.Encoding.Default);
    Msg.Text = "The content of the file you uploaded is: <br/> <br/>" + sr.ReadToEnd ();
    sr.Close ();
    UpLoadStream.Close ();
    UpLoadStream = null;
    sr = null;
Reply

Use magic Report

2

Threads

6

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

 Author| Post time: 2020-4-16 15:45:01
| Show all posts
Object Nothing = System.Reflection.Missing.Value;
// Get Word file save path
object filename = "E: / site // New Microsoft Word document.doc";
// Create a component object named WordApp
Word.Application WordApp = new Word.ApplicationClass ();
// Open the document object
WordApp.Documents .Open (ref filename, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing , ref Nothing);
this.read_tb .Text = WordApp.MailMessage .ToString ();
// Save
WordApp.ActiveDocument.SaveAs2000 (ref filename, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing, ref Nothing);
                                //shut down
WordApp.ActiveDocument.Close (ref Nothing, ref Nothing, ref Nothing);
WordApp.Quit (ref Nothing, ref Nothing, ref Nothing);
-------------------------------
Still can't read it
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list