SautinSoft

by Voodoo Editor
1 month ago
44 Views

Table of Contents


Using the “SautinSoft” Library in the Voodoo RPA Studio

If a PDF File is needed to convert to Excel File (.xls), The SautinSoft library can be used as library via VooDoo Studio. It helps to convert a PDF to Excel in miliseconds.

SautinSoft Library can be downloadable from this hyperlink —> “DOWNLOAD via NuGeT”

Note : Libraries;

  • using SautinSoft
  • using Microsoft.Office.Interop.Excel
  • using OfficeOpenXml

Example #1

The Example below shows how to convert PDF file to XLS file.

namespace VoodooImplementation {
    using System;
    using VooDooCommonData.CommonInterface;
    using VooDooCommonData.InstanceData;
    using System.Linq;
    using System.IO;
    using System.Buffers;
    using SautinSoft; // This is the library which is converting PDF Files To XLS Files
    using Microsoft.Office.Interop.Excel; // Manipulation on Excel Via Microsoft INTEROP
    using OfficeOpenXml; // Manipulation on Excel Via EPPlus v4.5.3 (This only reads .xlsx files)
    
    public class ComputationEvaluator : System.MarshalByRefObject, IPlugInComputation {
        
        private bool result_;
        
        private VooDooCommonData.InstanceData.PlanDataInstanceManager planDataInstanceManager_;
        
        /// Default Constructor for class
        public ComputationEvaluator() {
        }
        
        public bool result {
            get {
                return result_;
            }
        }
        
        public virtual VooDooCommonData.InstanceData.PlanDataInstanceManager planDataInstanceManager {
            get {
                return planDataInstanceManager_;
            }
            set {
                planDataInstanceManager_ = value;
            }
        }
        
        /// Calculate
        public virtual void ExecuteComputation()
        {

            string pdfPath = ""; // This variable for defining the path of PDF File
            string xlsPath = ""; // This variable for defining the output of PDF Conversion (file type: .xls);

            string xlsxFile = ""; // This variable for defining the output of XLS Conversion (Optional: The XLS File can be workable with Microsoft.Interop.Excel Library. So if you do not need to conversion, do not need this variable)

            PdfFocus pdfFocus = new PdfFocus(); // Defining the new Object PdfFocus Object
            pdfFocus.OpenPdf(pdfPath); // Defining the path of PDF
            pdfFocus.ToExcel(); // Conversion Process through the Excel
            pdfFocus.Dispose(); // Disposes the PDF

            ConvertXLS_XLSX(new FileInfo(xlsPath));

        }


        // This Method converts .xls files to .xlsx files
        public static void ConvertXLS_XLSX(FileInfo file)
        {
            var app = new Microsoft.Office.Interop.Excel.Application();
            var xlsFile = file.FullName;
            var wb = app.Workbooks.Open(xlsFile);
            var xlsxFile = xlsFile + "x";
            wb.SaveAs(Filename: xlsxFile, FileFormat: Microsoft.Office.Interop.Excel.XlFileFormat.xlOpenXMLWorkbook);
            wb.Close();
            app.Quit();
        }
    }
}