public static void Run()
        {
            // ExStart:RenderWorksheetToGraphicContext
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Create workbook object from source file
            Workbook workbook = new Workbook(dataDir + "SampleBook.xlsx");

            // Access first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Create empty Bitmap
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(1100, 600);

            // Create Graphics Context
            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
            g.Clear(System.Drawing.Color.Blue);

            // Set one page per sheet to true in image or print options
            Aspose.Cells.Rendering.ImageOrPrintOptions opts = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            opts.OnePagePerSheet = true;

            // Render worksheet to graphics context
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(worksheet, opts);
            sr.ToImage(0, g, 0, 0);

            // Save the graphics context image in Png format
            bmp.Save(dataDir + "OutputImage_out.png", System.Drawing.Imaging.ImageFormat.Png);
            //ExEnd:RenderWorksheetToGraphicContext
        }
示例#2
0
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Path.GetFullPath("../../../Data/");

            //Open an Excel file
            Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(dataDir + "Book1.xls");

            //Get the first worksheet
            Aspose.Cells.Worksheet sheet = workbook.Worksheets[0];

            //Apply different Image and Print options
            Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();

            //Set the Format
            options.SaveFormat = SaveFormat.XPS;

            //Render the sheet with respect to specified printing options
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, options);

            // Save
            sr.ToImage(0, dataDir + "out_printingxps.xps");

            //Export the whole workbook to XPS
            Aspose.Cells.Rendering.WorkbookRender wr = new Aspose.Cells.Rendering.WorkbookRender(workbook, options);
            wr.ToImage(dataDir + "out_whole_printingxps.xps");
        }
示例#3
0
        /// <summary>
        /// 打印DEMO
        /// Aspose.Cell 原理输出为Image, 打印Image
        /// </summary>
        public static void PrintDemo(string filePath)
        {
            Workbook workbook = new Workbook(filePath);

            //Get the worksheet to be printed
            Worksheet worksheet = workbook.Worksheets[0];

            PageSetup pageSetup = worksheet.PageSetup;

            pageSetup.Orientation = PageOrientationType.Landscape;
            //pageSetup.LeftMargin = 0;
            //pageSetup.RightMargin = 0.1;
            //pageSetup.BottomMargin = 0.3;
            //pageSetup.PrintArea = "A2:J29"; // 打印区域
            //Apply different Image / Print options.

            Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();

            //Set the Printing page property
            //options.PrintingPage = PrintingPageType.IgnoreStyle;
            //Render the worksheet

            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(worksheet, options);

            System.Drawing.Image map = sr.ToImage(0); // 核心 -- 将 SheetRendar转为 Image 进行打印
                                                      // map.Save(@"D:\HoweDesktop\A{0}".FormatWith(DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss")));

            // send to printer 核心打印 Image
            System.Drawing.Printing.PrinterSettings printSettings = new System.Drawing.Printing.PrinterSettings();
            string strPrinterName = printSettings.PrinterName;

            sr.ToPrinter(strPrinterName);
        }
        public static void Run()
        {
            // ExStart:1
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Open an Excel file
            Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(dataDir + "Book1.xls");

            // Get the first worksheet
            Aspose.Cells.Worksheet sheet = workbook.Worksheets[0];

            // Apply different Image and Print options
            Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();

            // Set the Format
            options.SaveFormat = SaveFormat.XPS;

            // Render the sheet with respect to specified printing options
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, options);

            // Save
            sr.ToImage(0, dataDir + "out_printingxps.out.xps");

            // Export the whole workbook to XPS
            Aspose.Cells.Rendering.WorkbookRender wr = new Aspose.Cells.Rendering.WorkbookRender(workbook, options);
            wr.ToImage(dataDir + "out_whole_printingxps.out.xps");
            // ExEnd:1
        }
示例#5
0
        public static void Run()
        {
            // ExStart:1
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Create workbook object from source file
            Workbook workbook = new Workbook(sourceDir + "sampleWorksheetToImageDesiredSize.xlsx");

            // Access first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Set image or print options we want one page per sheet. The image format is in png and desired dimensions are 400x400
            Aspose.Cells.Rendering.ImageOrPrintOptions opts = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            opts.OnePagePerSheet = true;
            opts.ImageType       = Drawing.ImageType.Png;
            opts.SetDesiredSize(400, 400);

            // Render sheet into image
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(worksheet, opts);
            sr.ToImage(0, outputDir + "outputWorksheetToImageDesiredSize.png");
            // ExEnd:1

            Console.WriteLine("WorksheetToImageDesiredSize executed successfully.");
        }
示例#6
0
        public static void Run()
        {
            //Source directory
            string sourceDir = RunExamples.Get_SourceDirectory();

            //Output directory
            string outputDir = RunExamples.Get_OutputDirectory();

            // Create workbook object from source file
            Workbook workbook = new Workbook(sourceDir + "sampleRenderWorksheetToGraphicContext.xlsx");

            // Access first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Create empty Bitmap
            System.Drawing.Bitmap bmp = new System.Drawing.Bitmap(1100, 600);

            // Create Graphics Context
            System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp);
            g.Clear(System.Drawing.Color.Blue);

            // Set one page per sheet to true in image or print options
            Aspose.Cells.Rendering.ImageOrPrintOptions opts = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            opts.OnePagePerSheet = true;

            // Render worksheet to graphics context
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(worksheet, opts);
            sr.ToImage(0, g, 0, 0);

            // Save the graphics context image in Png format
            bmp.Save(outputDir + "outputRenderWorksheetToGraphicContext.png", System.Drawing.Imaging.ImageFormat.Png);

            Console.WriteLine("RenderWorksheetToGraphicContext executed successfully.");
        }
        public static void Main(string[] args)
        {
            // The path to the documents directory.
            string dataDir = Aspose.Cells.Examples.Utils.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            //Open an Excel file
            Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(dataDir + "Book1.xls");

            //Get the first worksheet
            Aspose.Cells.Worksheet sheet = workbook.Worksheets[0];

            //Apply different Image and Print options
            Aspose.Cells.Rendering.ImageOrPrintOptions options = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            
            //Set the Format
            options.SaveFormat = SaveFormat.XPS;
            
            //Render the sheet with respect to specified printing options
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, options);
            
            // Save
            sr.ToImage(0, dataDir + "out_printingxps.xps");

            //Export the whole workbook to XPS
            Aspose.Cells.Rendering.WorkbookRender wr = new Aspose.Cells.Rendering.WorkbookRender(workbook, options);
            wr.ToImage(dataDir + "out_whole_printingxps.xps");
        }
        public static void Main()
        {
            // ExStart: 1
            // Load sample Excel file containing slicer.
            Workbook wb = new Workbook(sourceDir + "sampleRenderingSlicer.xlsx");

            // Access first worksheet.
            Worksheet ws = wb.Worksheets[0];

            // Set the print area because we want to render slicer only.
            ws.PageSetup.PrintArea = "B15:E25";

            // Specify image or print options, set one page per sheet and only area to true.
            Aspose.Cells.Rendering.ImageOrPrintOptions imgOpts = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            imgOpts.HorizontalResolution = 200;
            imgOpts.VerticalResolution   = 200;
            imgOpts.ImageType            = Aspose.Cells.Drawing.ImageType.Png;
            imgOpts.OnePagePerSheet      = true;
            imgOpts.OnlyArea             = true;

            // Create sheet render object and render worksheet to image.
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(ws, imgOpts);
            sr.ToImage(0, outputDir + "outputRenderingSlicer.png");
            // ExEnd: 1

            Console.WriteLine("RenderingSlicer executed successfully.");
        }
示例#9
0
        /// <summary>
        /// 转换为图片
        /// </summary>
        /// <param name="filepath"></param>
        /// <param name="imageFolderName"></param>
        /// <param name="imageFolderRootPath"></param>
        public void ConvertToImage(string filepath, string imageFolderName, string imageFolderRootPath)
        {
            if (!Directory.Exists(imageFolderRootPath))
            {
                ///若路径不存在,创建路径
                Directory.CreateDirectory(imageFolderRootPath);
            }

            if (!Directory.Exists(imageFolderRootPath + "\\" + imageFolderName))
            {
                ///若路径不存在,创建路径
                Directory.CreateDirectory(imageFolderRootPath + "\\" + imageFolderName);
            }


            Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(filepath);
            var count = 0;

            foreach (Aspose.Cells.Worksheet sheet in workbook.Worksheets)
            {
                if (sheet.IsVisible)
                {
                    //Define ImageOrPrintOptions
                    Aspose.Cells.Rendering.ImageOrPrintOptions imgOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();
                    //Specify the image format
                    imgOptions.AllColumnsInOnePagePerSheet = true;
                    imgOptions.IsCellAutoFit = true;
                    imgOptions.OnlyArea      = false;
                    imgOptions.OnlyArea      = true;
                    imgOptions.ImageFormat   = System.Drawing.Imaging.ImageFormat.Png;
                    //Only one page for the whole sheet would be rendered
                    imgOptions.OnePagePerSheet = false;

                    //Render the sheet with respect to specified image/print options
                    Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, imgOptions);
                    for (int i = 0; i < sr.PageCount; i++)
                    {
                        count++;
                        string imageFilePath = string.Format(@"{0}\{1}\{2}.png", imageFolderRootPath, imageFolderName, i);
                        sr.ToImage(i, imageFilePath);
                    }
                    //Render the image for the sheet

                    //System.Drawing.Bitmap bitmap = sr.ToImage(0,"D:\\1.jpg");

                    //Save the image file specifying its image format.
                    // bitmap.Save(@"d:\test\SheetImage.jpg");
                }
            }

            string jsFileName = string.Format(@"{0}\{1}\{2}.js", imageFolderRootPath, imageFolderName, "info");
            var    fileType   = (filepath.EndsWith(".xlsx")) ? "xlsx" : "xls";

            File.WriteAllText(jsFileName, "var imageInfo={PageCount:" + count + ",FileType:'" + fileType + "'}");
        }
示例#10
0
        private static void XlsToImgMothed(string filename, Workbook book, Aspose.Cells.Rendering.ImageOrPrintOptions imgOptions, int i)
        {
            //获取一张工作表
            Worksheet sheet = book.Worksheets[i];

            //创建一个纸张底色渲染对象
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(sheet, imgOptions);
            for (int j = 0; j < sr.PageCount; j++)
            {
                string imgpath = imageDirectoryPath + "/" + filename + "_" + i + "_" + j + "_.jpeg";
                if (!File.Exists(imgpath))
                {
                    sr.ToImage(j, imgpath);
                }
            }
        }
示例#11
0
        /// <summary>
        /// 生成缩略图,只生成第一张页面的缩略图
        /// </summary>
        /// <param name="fileBuffer">文件的字节数组</param>
        /// <param name="fileType">文件类型,目前支持:Word、Excel、PDF</param>
        public static byte[] ConvertToSnap(byte[] fileBuffer, string fileType)
        {
            var snapStream = new MemoryStream();

            if (fileType == "xls" || fileType == "xlsx")
            {
                var book       = new Aspose.Cells.Workbook(new MemoryStream(fileBuffer));
                var sheet      = book.Worksheets[0];
                var imgOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions
                {
                    OnePagePerSheet      = true,
                    VerticalResolution   = 400,
                    HorizontalResolution = 300,
                    ImageFormat          = System.Drawing.Imaging.ImageFormat.Jpeg
                };
                var sr = new Aspose.Cells.Rendering.SheetRender(sheet, imgOptions);
                sr.ToImage(0, snapStream);
            }
            else if (fileType == "doc" || fileType == "docx")
            {
                var doc        = new Aspose.Words.Document(new MemoryStream(fileBuffer));
                var imgOptions = new Aspose.Words.Saving.ImageSaveOptions(Aspose.Words.SaveFormat.Jpeg)
                {
                    Resolution = 400,
                };
                doc.Save(snapStream, imgOptions);
            }
            else if (fileType == "pdf")
            {
                var converter = new Aspose.Pdf.Facades.PdfConverter();
                converter.BindPdf(new Aspose.Pdf.Document(new MemoryStream(fileBuffer)));
                converter.DoConvert();
                converter.GetNextImage(snapStream, new Aspose.Pdf.PageSize(200, 150), System.Drawing.Imaging.ImageFormat.Jpeg);
            }

            var result = snapStream.ToArray();

            snapStream.Close();
            return(result);
        }
示例#12
0
        public static void Run()
        {
            // ExStart:WorksheetToImageDesiredSize
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Create workbook object from source file
            Workbook workbook = new Workbook(dataDir + "SampleBook.xlsx");

            // Access first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Set image or print options we want one page per sheet. The image format is in png and desired dimensions are 400x400
            Aspose.Cells.Rendering.ImageOrPrintOptions opts = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            opts.OnePagePerSheet = true;
            opts.ImageFormat     = System.Drawing.Imaging.ImageFormat.Png;
            opts.SetDesiredSize(400, 400);

            // Render sheet into image
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(worksheet, opts);
            sr.ToImage(0, dataDir + "ImageWithDesiredSize_out.png");
            // ExEnd:WorksheetToImageDesiredSize
        }
        public static void Run()
        {
            // ExStart:WorksheetToImageDesiredSize
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);

            // Create workbook object from source file
            Workbook workbook = new Workbook(dataDir + "SampleBook.xlsx");

            // Access first worksheet
            Worksheet worksheet = workbook.Worksheets[0];

            // Set image or print options we want one page per sheet. The image format is in png and desired dimensions are 400x400
            Aspose.Cells.Rendering.ImageOrPrintOptions opts = new Aspose.Cells.Rendering.ImageOrPrintOptions();
            opts.OnePagePerSheet = true;
            opts.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
            opts.SetDesiredSize(400, 400);

            // Render sheet into image
            Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(worksheet, opts);
            sr.ToImage(0, dataDir + "ImageWithDesiredSize_out.png");
            // ExEnd:WorksheetToImageDesiredSize
        }
        protected Response Process(string controllerName, string fileName, string folderName, string outFileExtension, bool createZip, bool checkNumberofPages, string methodName, ActionDelegate action,
                                   bool deleteSourceFolder = true, string zipFileName = null)
        {
            string guid         = Guid.NewGuid().ToString();
            string outFolder    = "";
            string sourceFolder = Aspose.App.Live.Demos.UI.Config.Configuration.WorkingDirectory + folderName;

            fileName = sourceFolder + "\\" + fileName;

            string fileExtension = Path.GetExtension(fileName).ToLower();

            // Check if tiff file have more than one number of pages to create zip file or not
            if ((checkNumberofPages) && (createZip) && (controllerName == "AsposeImagingConversionController") && (Path.GetExtension(fileName).ToLower() == ".tiff" || Path.GetExtension(fileName).ToLower() == ".tif"))
            {
                // Get the frame dimension list from the image of the file and
                Image _image = Image.FromFile(fileName);
                // Get the globally unique identifier (GUID)
                Guid objGuid = _image.FrameDimensionsList[0];
                // Create the frame dimension
                FrameDimension dimension = new FrameDimension(objGuid);
                // Gets the total number of frames in the .tiff file
                int noOfPages = _image.GetFrameCount(dimension);
                createZip = noOfPages > 1;
                _image.Dispose();
            }

            // Check word file have more than one number of pages or not to create zip file
            else if ((checkNumberofPages) && (createZip) && (controllerName == "AsposeWordsConversionController"))
            {
                Aspose.Words.Document doc = new Aspose.Words.Document(fileName);
                createZip = doc.PageCount > 1;
            }
            // Check presentation file have one or more slides to create zip file
            else if ((checkNumberofPages) && (createZip) && (controllerName == "AsposeSlidesAPIsController"))
            {
                Aspose.Slides.Presentation presentation = new Aspose.Slides.Presentation(fileName);
                createZip = presentation.Slides.Count > 1;
            }
            // Check visio file have one or more pages to create zip file
            else if ((checkNumberofPages) && (createZip) && (controllerName == "AsposeDiagramConversionController"))
            {
                Aspose.Diagram.Diagram diagram = new Aspose.Diagram.Diagram(fileName);
                createZip = diagram.Pages.Count > 1;
            }
            // Check email file have one or more pages to create zip file
            else if ((checkNumberofPages) && (createZip) && (controllerName == "AsposeEmailConversionController"))
            {
                Aspose.Email.MailMessage msg = Aspose.Email.MailMessage.Load(fileName);

                MemoryStream msgStream = new MemoryStream();
                msg.Save(msgStream, Aspose.Email.SaveOptions.DefaultMhtml);
                Aspose.Words.Document document = new Aspose.Words.Document(msgStream);

                createZip = document.PageCount > 1;
            }
            //Check excel file have more than on workseets to create zip or not
            else if ((checkNumberofPages) && (createZip) && (controllerName == "AsposeCellsAPIsController") && (outFileExtension != ".svg"))
            {
                Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(fileName);
                createZip = workbook.Worksheets.Count > 1;
            }
            //Check note file have more than on pages to create zip or not
            else if ((checkNumberofPages) && (createZip) && (controllerName == "AsposeNoteConversionController"))
            {
                Aspose.Note.Document document = new Aspose.Note.Document(fileName);
                int count = document.GetChildNodes <Aspose.Note.Page>().Count;
                createZip = count > 1;
            }
            //Check pdf file have more than on pages to create zip or not
            else if ((checkNumberofPages) && (createZip) && (controllerName == "AsposePdfConversionController"))
            {
                Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(fileName);
                createZip = pdfDocument.Pages.Count > 1;
            }
            //Check excel file have more than on workseets to create zip or not
            else if ((checkNumberofPages) && (createZip) && (controllerName == "AsposeCellsAPIsController") && (outFileExtension == ".svg"))
            {
                Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(fileName);
                if (workbook.Worksheets.Count > 1)
                {
                    createZip = true;
                }
                else
                {
                    Aspose.Cells.Rendering.ImageOrPrintOptions imgOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();
                    imgOptions.OnePagePerSheet = true;
                    Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(workbook.Worksheets[0], imgOptions);
                    int srPageCount = sr.PageCount;
                    createZip = srPageCount > 1;
                }
            }



            string outfileName = Path.GetFileNameWithoutExtension(fileName) + outFileExtension;
            string outPath     = "";

            string zipOutFolder = Aspose.App.Live.Demos.UI.Config.Configuration.OutputDirectory + guid;
            string zipOutfileName, zipOutPath;

            if (string.IsNullOrEmpty(zipFileName))
            {
                zipOutfileName = guid + ".zip";
                zipOutPath     = Aspose.App.Live.Demos.UI.Config.Configuration.OutputDirectory + zipOutfileName;
            }
            else
            {
                var guid2 = Guid.NewGuid().ToString();
                outFolder      = guid2;
                zipOutfileName = zipFileName + ".zip";
                zipOutPath     = Aspose.App.Live.Demos.UI.Config.Configuration.OutputDirectory + guid2;
                Directory.CreateDirectory(zipOutPath);
                zipOutPath += "/" + zipOutfileName;
            }

            if (createZip)
            {
                outfileName = Path.GetFileNameWithoutExtension(fileName) + outFileExtension;
                outPath     = zipOutFolder + "/" + outfileName;
                Directory.CreateDirectory(zipOutFolder);
            }
            else
            {
                outFolder = guid;
                outPath   = Aspose.App.Live.Demos.UI.Config.Configuration.OutputDirectory + outFolder;
                Directory.CreateDirectory(outPath);

                outPath += "/" + outfileName;
            }

            string statusValue     = "OK";
            int    statusCodeValue = 200;

            try
            {
                action(fileName, outPath, zipOutFolder);

                if (createZip)
                {
                    ZipFile.CreateFromDirectory(zipOutFolder, zipOutPath);
                    Directory.Delete(zipOutFolder, true);
                    outfileName = zipOutfileName;
                }

                if (deleteSourceFolder)
                {
                    System.GC.Collect();
                    System.GC.WaitForPendingFinalizers();
                    Directory.Delete(sourceFolder, true);
                }
            }
            catch (Exception ex)
            {
                statusCodeValue = 500;
                statusValue     = "500 " + ex.Message;
            }
            return(new Response
            {
                FileName = outfileName,
                FolderName = outFolder,
                Status = statusValue,
                StatusCode = statusCodeValue,
            });
        }
示例#15
0
        protected Response Process(string modelName, string fileName, string folderName, string outFileExtension, bool createZip, bool checkNumberofPages, string methodName, ActionDelegate action,
                                   bool deleteSourceFolder = true, string zipFileName = null)
        {
            string guid         = Guid.NewGuid().ToString();
            string outFolder    = "";
            string sourceFolder = Aspose.Cells.Live.Demos.UI.Config.Configuration.WorkingDirectory + folderName;

            fileName = sourceFolder + "\\" + fileName;

            string fileExtension = Path.GetExtension(fileName).ToLower();


            // Check Excel file have more than one number of sheets or not to create zip file
            if ((checkNumberofPages) && (createZip) && (modelName == "AsposeCellsConversion") && (outFileExtension == ".svg"))
            {
                Aspose.Cells.Workbook workbook = new Aspose.Cells.Workbook(fileName);
                if (workbook.Worksheets.Count > 1)
                {
                    createZip = true;
                }
                else
                {
                    Aspose.Cells.Rendering.ImageOrPrintOptions imgOptions = new Aspose.Cells.Rendering.ImageOrPrintOptions();
                    imgOptions.OnePagePerSheet = true;
                    Aspose.Cells.Rendering.SheetRender sr = new Aspose.Cells.Rendering.SheetRender(workbook.Worksheets[0], imgOptions);
                    int srPageCount = sr.PageCount;
                    createZip = srPageCount > 1;
                }
            }

            string outfileName = Path.GetFileNameWithoutExtension(fileName) + outFileExtension;
            string outPath     = "";

            string zipOutFolder = Aspose.Cells.Live.Demos.UI.Config.Configuration.OutputDirectory + guid;
            string zipOutfileName, zipOutPath;

            if (string.IsNullOrEmpty(zipFileName))
            {
                zipOutfileName = guid + ".zip";
                zipOutPath     = Aspose.Cells.Live.Demos.UI.Config.Configuration.OutputDirectory + zipOutfileName;
            }
            else
            {
                var guid2 = Guid.NewGuid().ToString();
                outFolder      = guid2;
                zipOutfileName = zipFileName + ".zip";
                zipOutPath     = Aspose.Cells.Live.Demos.UI.Config.Configuration.OutputDirectory + guid2;
                if (createZip)
                {
                    Directory.CreateDirectory(zipOutPath);
                }
                zipOutPath += "/" + zipOutfileName;
            }

            if (createZip)
            {
                outfileName = Path.GetFileNameWithoutExtension(fileName) + outFileExtension;
                outPath     = zipOutFolder + "/" + outfileName;
                Directory.CreateDirectory(zipOutFolder);
            }
            else
            {
                outFolder = guid;
                outPath   = Aspose.Cells.Live.Demos.UI.Config.Configuration.OutputDirectory + outFolder;
                Directory.CreateDirectory(outPath);

                outPath += "/" + outfileName;
            }

            string statusValue     = "OK";
            int    statusCodeValue = 200;

            try
            {
                action(fileName, outPath, zipOutFolder);

                if (createZip)
                {
                    ZipFile.CreateFromDirectory(zipOutFolder, zipOutPath);
                    Directory.Delete(zipOutFolder, true);
                    outfileName = zipOutfileName;
                }

                if (deleteSourceFolder)
                {
                    System.GC.Collect();
                    System.GC.WaitForPendingFinalizers();
                    Directory.Delete(sourceFolder, true);
                }
            }
            catch (Exception ex)
            {
                statusCodeValue = 500;
                statusValue     = "500 " + ex.Message;
            }
            return(new Response
            {
                FileName = outfileName,
                FolderName = outFolder,
                Status = statusValue,
                StatusCode = statusCodeValue,
                FileProcessingErrorCode = FileProcessingErrorCode.OK
            });
        }