private void DoExportUsingFlexCelImgExportSimple(ImageColorDepth ColorDepth) { if (!HasFileOpen()) { return; } if (!LoadPreferences()) { return; } if (exportImageDialog.ShowDialog() != DialogResult.OK) { return; } ImageExportType ImgFormat = ImageExportType.Png; if (String.Compare(Path.GetExtension(exportImageDialog.FileName), ".jpg", true) == 0) { ImgFormat = ImageExportType.Jpeg; } using (FlexCelImgExport ImgExport = new FlexCelImgExport(flexCelPrintDocument1.Workbook)) { ImgExport.AllVisibleSheets = cbAllSheets.Checked; ImgExport.ResetPageNumberOnEachSheet = cbResetPageNumber.Checked; ImgExport.Resolution = 96; //To get a better quality image but with larger file size too, increate this value. (for example to 300 or 600 dpi) ImgExport.SaveAsImage(exportImageDialog.FileName, ImgFormat, ColorDepth); } }
//How to create a multipage tiff using FlexCelImgExport. //This will create a multipage tiff with the data. private void DoExportMultiPageTiff(ImageColorDepth ColorDepth, bool IsFax) { if (!HasFileOpen()) { return; } if (!LoadPreferences()) { return; } if (exportTiffDialog.ShowDialog() != DialogResult.OK) { return; } ImageExportType ExportType = ImageExportType.Tiff; if (IsFax) { ExportType = ImageExportType.Fax; } using (FlexCelImgExport ImgExport = new FlexCelImgExport(flexCelPrintDocument1.Workbook)) { ImgExport.AllVisibleSheets = cbAllSheets.Checked; ImgExport.ResetPageNumberOnEachSheet = cbResetPageNumber.Checked; ImgExport.Resolution = 96; //To get a better quality image but with larger file size too, increate this value. (for example to 300 or 600 dpi) using (FileStream TiffStream = new FileStream(exportTiffDialog.FileName, FileMode.Create)) { ImgExport.SaveAsImage(TiffStream, ExportType, ColorDepth); } } if (MessageBox.Show("Do you want to open the generated file?", "Confirm", MessageBoxButtons.YesNo) == DialogResult.Yes) { Process.Start(exportTiffDialog.FileName); } }