c# - How can you set legal as the default printing size in an rdlc file? -
i have c#.net reportviewer rdlc file want print in legal size default. no matter print dialog has paper size set letter. unless change legal before printing report cut off.
someone suggested setting report size manually or changing units cm inches didn't seem have affect. ideas?
this contents of rdlc file:
<?xml version="1.0" encoding="utf-8"?> <report xmlns:rd="http://schemas.microsoft.com/sqlserver/reporting/reportdesigner" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"> <body> <reportitems> <subreport name="loadoutreport"> <reportname>loadoutreport</reportname> <parameters> <parameter name="groupingproperty"> <value>grouping</value> </parameter> <parameter name="groupingvalue"> <value>1</value> </parameter> </parameters> <height>6.67396cm</height> <width>7.5cm</width> <style> <border> <style>solid</style> </border> <rightborder> <color>black</color> </rightborder> </style> </subreport> <subreport name="loadoutreport2"> <reportname>loadoutreport</reportname> <parameters> <parameter name="groupingproperty"> <value>grouping</value> </parameter> <parameter name="groupingvalue"> <value>1</value> </parameter> </parameters> <left>7.60583cm</left> <height>6.67396cm</height> <width>7.5cm</width> <zindex>1</zindex> <style> <border> <style>solid</style> </border> <leftborder> <color>black</color> </leftborder> <rightborder> <color>black</color> </rightborder> </style> </subreport> <subreport name="loadoutreport3"> <reportname>loadoutreport</reportname> <parameters> <parameter name="groupingproperty"> <value>grouping</value> </parameter> <parameter name="groupingvalue"> <value>1</value> </parameter> </parameters> <left>15.21167cm</left> <height>6.67396cm</height> <width>7.5cm</width> <zindex>2</zindex> <style> <border> <style>solid</style> </border> <leftborder> <color>black</color> </leftborder> </style> </subreport> </reportitems> <height>2.62754in</height> <style /> </body> <width>8.9416in</width> <page> <pageheight>8.5in</pageheight> <pagewidth>14in</pagewidth> <leftmargin>0.5in</leftmargin> <rightmargin>0.3937in</rightmargin> <topmargin>1in</topmargin> <bottommargin>0.7874in</bottommargin> <columnspacing>0.05118in</columnspacing> <style /> </page> <rd:reportid>f154f70e-de6e-4320-82c8-44d60995e61a</rd:reportid> <rd:reportunittype>inch</rd:reportunittype> </report>
try in form load report viewer located ....
using system.drawing.printing;
...
pagesettings ps = new pagesettings(); //declare new pagesettings printing ps.landscape = false; //set true landscape, false portrait ps.margins = new margins(0, 0, 0, 0); //set margins //choose paper size paper sizes defined in ur printer. //here use linq choose name ps.papersize = (from papersize p in ps.printersettings.papersizes p.papername == "legal" select p).first(); //alternatively can set paper size custom //ps.papersize = new papersize("mypapersize", 100, 100); reportviewer1.setpagesettings(ps);
Comments
Post a Comment