Locked read/write word,ppt and pdf in c#?

  • Saturday, March 03, 2012 12:10 PM
     
     

    Hi,

    i am trying to read word,ppt and pdf to webpage.

    is there any possibility that i can use bytereader to read these files and by using bytewriter class can render the content on a webpage?

    thanks,

    Gaurav

All Replies

  • Monday, March 05, 2012 7:26 AM
    Moderator
     
     Answered

    Hi Gaurav,

    Welcome to the MSDN Forum.

    I don't recommend you to use binaryReader to read Word, ppt, and pdf such compliex documents. If it is just a plain text document, like .txt file, this will be an option. 

    To convert the word to web page, you can try the SaveAs method. For ppt, you can try to convert it to xml file and then read the xml node to write your web page. 

    Here is an article about "How to: Manipulate Office Open XML Formats Documents": http://msdn.microsoft.com/en-us/library/aa982683(v=office.12).aspx. Especially, this paragraph: Manipulating Office Open XML Formats Documents Programmatically

    You can use tools on almost any platform capable of working with XML and ZIP files to access and alter document contents. For example, you can write a server-side application in Microsoft Visual Studio with managed code (Microsoft Visual Basic .NET or C#) to programmatically generate 2007 Office system documents. You can use the powerful XML class library of the Microsoft .NET Framework to work with any of the XML document parts found in Office Open XML Formats files.

    In your case, you just need to read the content and write them to a webpage.

    About how to convert PDF files to web pages, please try the Adobe forum: http://forums.adobe.com/community/adobe_reader_forums 

    I hope this will be helpful.

    Best regards,


    Mike Feng
    MSDN Community Support | Feedback to us
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Tuesday, March 06, 2012 7:05 AM
     
     Answered

    You may lose the actual format and style of content of document if you use ByteWriter class.

    There are couples of options to do that. But using inbuilt SaveAs() method looks to be a good option. As Mike said you can read the xml and write XML node content or you can directly convert .doc to a .html file and redirect these .html file to asp.net. Hope below samples would help you more on this.

    http://msdn.microsoft.com/en-us/library/aa662158%28office.10%29.aspx

    http://www.codeproject.com/Articles/5273/How-to-convert-DOC-into-other-formats-using-C


    Lingaraj Mishra