ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2016-07-01 20:59:00

Gavin
Member
Registered: 2016-06-23
Posts: 8

setting PrintSettings.Margins

Hi.

Please can you help me set my print margins to 1cm all-round (or top and bottom = 1cm, left and right = 1.5cm)

This is what I have tried, but the compiler complains when the value is a fraction (it works if I can set it to 1 inch but not less):
worksheet.PrintSettings.Margins = new unvell.ReoGrid.Print.PageMargins(0.4);

Offline

#2 2016-07-02 02:44:54

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: setting PrintSettings.Margins

The PageMargins structure receives inch, to set cm, you have to convert cm to inch, here is an example:

// 1 inch = 2.54 cm
const float cmPreInch = 2.54f;

sheet.PrintSettings.Margins = new PageMargins(1.0f / cmPreInch);  // 1cm

Check the result on print settings dialog: 0.39 inch = 0.99 cm
442.png

Offline

#3 2016-07-02 09:06:12

Gavin
Member
Registered: 2016-06-23
Posts: 8

Re: setting PrintSettings.Margins

Thats perfect. Thank you so much.

Offline

Board footer

Powered by FluxBB