How to convert any type of file to string?


  • How to convert any type of file to string?

    I have to look for a specific value in different type of files .doc, .xls, .pdf, .aspx....

    is there a code to convert any extension file to string using c# ?

    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Wednesday, May 3, 2017 6:28 PM

All replies

  • Hello,

    There is not one library in C# designed for what you are asking. This would be a large operation e.g. consider .doc which is binary, .docx which is a compressed file with a raw format of text. A .pdf, that is simple in nature vs a complex one can move through decision trees from a free library to something say like Aspose for pdf etc.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, May 3, 2017 9:42 PM
  • How to convert any type of file to string?


    you can convert any type of file to a Base64 string (like it is done when attaching a file to an email). There are functions in the framework to convertTo and (re-) convertFrom Base64 strings:



    Wednesday, May 3, 2017 11:54 PM