We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

CellsHelper.DPI Property


Syntax: public static double DPI { get; set; }
Description: Gets the DPI of the machine

Set - it works? What is it for? How can i change?

Determination of line height does not always work correctly at different display scales!

@Fiodar_Vasilets,

The property specifies the DPI settings. Please note, if the DPI is changed, the default column’s width or row’s height would be changed too in MS Excel. Aspose.Cells works the same way as MS Excel does. You may specify the DPI at the start of your program for your requirements:
e.g
Sample code:

.......
CellsHelper.DPI = 96;//This will be equal to 100% display settings of your os/machine. 
//........
// your code goes here.
//.......

Please note, for rendering features (e.g Excel to PDF, Sheet to image, etc.), Aspose.Cells only supports to render in 100% display settings. It means you will get the same results (for output PDF/image) in Ms Excel manually as you could generate (Save as PDF) in “100%” display settings.

DPI value does not change
DPI_001.png (11.9 KB)

@Fiodar_Vasilets,

Please note, the DPI should be set before it is initialized, so you should remove the first line. Use only one line:

CellsHelper.DPI = your_value_here;

Moreover, setting the dpi value to non-standard dpi is not suggested.

thank.

I think you need to add the description to https://reference.aspose.com/cells/net/aspose.cells/cellshelper/properties/dpi

144 dpi = 150% display scale

CellsHelper.DPI
This value should be determined automatically from the settings display scale?
I noticed that at 150% I get in some cases 96 and in some 144 dpi!
DPI_002.png (32.2 KB)

@Fiodar_Vasilets,
We have tried to reproduce this issue by setting the system display scale to 150 and then fetched the value of CellsHelper.DPI. It is returned as 144 which is the expected value. You may please share some steps to reproduce this issue as we are not able to reproduce it on different test systems. We will soon update the API reference in its .xml file to include more details on DPI attribute.
dpi.png (454.2 KB)

@Fiodar_Vasilets,
We have further tested and found that CellsHelper DPI we get is 96 although the machine DPI setting is 150% in some cases. Therefore, we suggest that you set machine DPI setting to 100%. Aspose.Cells works well with this setting.

Good day! I am critical in some cases to have DPI setting is 150%.

As I understand it, this is incorrect work Aspose!.

@Fiodar_Vasilets,
Please note that, currently Aspose.Cells works well at DPI setting 100%. However, Aspose.Cells may not work well at DPI setting 150%.