Excel to tiff -dpi as parameter

Hi,


I want convert excel to tiff with dpi as parameter,but i cant set dpi ,also attached the code i have used in it.


var options = new ImageOrPrintOptions
{
HorizontalResolution = 100,
VerticalResolution = 100,
ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff,
};

var workbook = new Workbook(inputFilePath);
foreach (Worksheet ws in workbook.Worksheets)
ws.SetVisible(ws.IsVisible, false);
workbook.Save(outputFilePath, SaveFormat.TIFF);

Thanks in advance

Hi,


Thanks for providing us sample code with details.

Please try to use WorkbookRender.ToImage() method instead, it would specify your desired horizontal and vertical resolutions fine. See the sample code for your reference:
e.g
Sample code:

var options = new ImageOrPrintOptions
{
HorizontalResolution = 100,
VerticalResolution = 100,
ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff,
};

Workbook wb = new Workbook(TMP_DIR + “test.xlsx”);
WorkbookRender wr = new WorkbookRender(wb, options);
wr.ToImage(TMP_DIR + “test.tiff”);

Let us know if you still have any issue.

Thank you.

Ok, Thanks its working.!


Regards
Aravind.A

Hi,


Good to know that your issue is sorted out now. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.

Thank you.