.Net component to convert between docx, pdf, excel, pptx, html, rtf in C#

We tried to erase customary distinctions between popular office formats and to give you an opportunity to choose your own format!
By: SautinSoft
 
Aug. 27, 2012 - PRLog -- Modern document circulation is swiftly developing and information flows in the outside world are quite various. Wherever you are, you constantly encounter electronic documents, whether  you work in an office, study at school or at the university, or are engaged in household chores. Every day we get, read, type, process or place different documents, charts, blanks, presentations, etc. Each of those data types has its representation – its format. This can be a traditional RTF format designed for all text documents. All text processors work with it, and besides, this format is known to every beginning user. This can also be a portable PDF format which doesn’t depend on the platform. Almost any document can be converted into this format. And there are also many other formats, which are used by million users in the world. Very often it is necessary not simply to open and to get acquainted with document contents, but also to process, to edit, to bring it in conformity with the required norms and rules, or operatively to place it on a site, to prepare an article for publication, to load information into database, to make a report or just simply save the information in the format suitable for you. In such conditions, technologies of data conversion in electronic document circulation are becoming more and more popular.
        We tried to erase customary distinctions between popular office formats and to give you an opportunity to choose your own format! SautinSoft company presents UseOffice .Net – powerful component for building conversion functions in server Web-applications ASP.NET and desktop applications Windows Forms for Windows platform including the following versions: 2000, XP, Vista, 2008 Server, Seven, Windows 8. Applications made on the basis of this solution, allow a user accurately and quickly to convert different documents – reports, questionnaires, invoices, articles, presentations, web-pages, etc. – into such formats as: DOC, DOCX, RTF, PPT, PDF, HTML. Converted documents totally keep visual characteristics of the original, including structure elements and formatting, such as tables, type style, colors, etc.
        The following conversion directions are supported:
•   DOC is converted into HTML, XML, RTF, TXT, PDF, DOCX
•   DOCX is converted into HTML, XML, RTF, TXT, PDF
•   HTML is converted into DOC, RTF, TXT, PDF
•   XLS is converted into HTML, XML, TXT, CSV, RTF, PDF
•   RTF is converted into HTML, XML, TXT, DOC, PDF
•   PPT is converted into HTML, XML, RTF, PDF, JPG, BMP, GIF
•   XLSX is converted into HTML, XML, TXT, CSV, RTF, PDF

Component UseOffice .Net can be easily integrated to any .Net application in C# and VB.Net languages, and for all that it is enough to know only programming fundamentals. Thus, users of your program products will have an opportunity to export documents into more than 10 formats including such popular formats as DOC, RTF, DOCX, PDF, HTML and Excel.

This is UseOffice .Net homepage: http://www.sautinsoft.com/convert-rtf-html-doc-docx-xls-x...

Let’s give an example in programming language C# to show how it is easy to convert all MS Office documents into PDF format:

         //Convert Word Excel PowerPoint to PDF files
         SautinSoft.UseOffice u = new SautinSoft.UseOffice();

         //directory which contains Word, Excel, PowerPoint files: *.doc, *.docx, *.rtf, *.txt, *.xls, *.xlsx, *.csv, *.ppt, *.pptx
         string pathToOfficeDocs = @"c:\Docs\";

         //Prepare UseOffice .Net, loads MS Word, Excel, PowerPoint into memory
         int ret = u.InitOffice();

         //Can't load MS Office in memory
         if (ret==111)
            return;
      
         //1. Get list of MS Office files from directory         
         ArrayList documents = new ArrayList();
         string[] filters = new string[] { "*.doc", "*.docx", "*.rtf", "*.txt", "*.xls", "*.xlsx", "*.csv", "*.ppt", "*.pptx" };

         foreach (string filter in filters)
         {
            documents.AddRange(Directory.GetFiles(pathToOfficeDocs, filter));
         }

         //2. Convert all Word, Excel, PorwerPoint files to PDF from specifed directory

         string ext ="";
         string outPutFile = "";
         for (int x=0; x< documents.Count; x++)
         {
            SautinSoft.UseOffice.eDirection direction = SautinSoft.UseOffice.eDirection.DOC_to_PDF;
            ext = Path.GetExtension((string)documents[x]).ToLower();

            if (ext.IndexOf("doc")>0)
               direction = SautinSoft.UseOffice.eDirection.DOC_to_PDF;
            else if (ext.IndexOf("rtf")>0)
               direction = SautinSoft.UseOffice.eDirection.RTF_to_PDF;         
            else if (ext.IndexOf("txt")>0)
               direction = SautinSoft.UseOffice.eDirection.RTF_to_PDF;
            else if (ext.IndexOf("xls")>0)
               direction = SautinSoft.UseOffice.eDirection.XLS_to_PDF;
            else if (ext.IndexOf("csv")>0)
               direction = SautinSoft.UseOffice.eDirection.XLS_to_PDF;
            else if (ext.IndexOf("ppt")>0)
               direction = SautinSoft.UseOffice.eDirection.PPT_to_PDF;

            outPutFile = Path.Combine(Path.GetDirectoryName((string)documents[x]),Path.GetFileNameWithoutExtension((string)documents[x]));
            outPutFile+=".pdf";            
            u.ConvertFile((string)documents[x],outPutFile, direction);
         }

         u.CloseOffice();
End
Source:SautinSoft
Email:***@sautinsoft.com Email Verified
Zip:427430
Tags:Docx, PDF, Net, Csharp, Convert
Industry:Computers
Location:Votkinsk - Udmurt Republic - Russian Federation
Account Email Address Verified     Account Phone Number Verified     Disclaimer     Report Abuse
Page Updated Last on: Aug 27, 2012
Sautin Software PRs
Trending News
Most Viewed
Top Daily News



Like PRLog?
9K2K1K
Click to Share