unable to print all pages

Posted by: suvi on 8 September 2017, 12:57 pm EST

  • Posted 8 September 2017, 12:57 pm EST

    Hi


    i am using Spread for Windows Forms v25 for Visual Studio 2005.


    sample project is attached here.


    I am not able to print all pages. Only first page is availabe for print.


    Please suggest me what i am missing.


    Thanks & Regards


    Deepak


     


     


     


    2008/01/PrinterTest.zip
  • Replied 8 September 2017, 12:57 pm EST

    You are not understanding the concepts involved. The code in your PrintPage handler is incorrect. What you need to do to print multiple pages is set ev.HasMorePages equal to true until you have printed all pages. The code in your loop inside that handler is also incorrect as each call to OwnerPrintDraw inside that loop is printing over top of the previous call.
  • Replied 8 September 2017, 12:57 pm EST

    <FONT face=Tahoma size=2>Hi, </FONT>


    <FONT face=Tahoma size=2>I am also having a problem printing all pages from a spread. My problem seems to be around printing rows that are "past" the bottom of what is displayed on-screen. If there are more columns than are displayed on the screen, they can be printed fine.</FONT>


    <FONT face=Tahoma size=2>The problems seems to be around the results of the following calls:</FONT>


    <FONT face=Tahoma size=2><FONT color=#008000>This method returns an array of length > 0 when there are more columns than can be printed on one page - which is exactly what I want
    </FONT></FONT><FONT face=Tahoma size=2><FONT size=2>_pageColInfo = _editor.Grid.GetOwnerPrintColumnPageBreaks(e.Graphics, _printDocumentRectangle, 0, </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>);</FONT>


    <FONT size=2><FONT color=#008000>This method returns an array of length = 0 irrespective of how many rows are in the data model, have tried true and false to recalculate, makes no difference
    </FONT>_pageRowInfo = _editor.Grid.GetOwnerPrintRowPageBreaks(e.Graphics, _printDocumentRectangle, 0, </FONT><FONT color=#0000ff size=2>false</FONT><FONT size=2>);</FONT>


    <FONT size=2><FONT color=#008000>This method returns a page count equivalent to the size of the above arrays, i.e. ok for more columns than can fit on one page, but not for more rows than can fit on one page</FONT>
    _pageCount = _editor.Grid.GetOwnerPrintPageCount(e.Graphics, _printDocumentRectangle, 0);</FONT>


    <FONT size=2>The code that sets the HasMorePages is thus:
    </FONT><FONT size=2>
    </FONT><FONT size=2><FONT size=2>e.HasMorePages = (_currentPrintPage <= _pageCount);   


    I have also tried using the bounds of the arrays to set e.HasMorePages, but as described above, these do not refelect the fact that more rows exists than are displayed on-screen, but work for columns.


    </FONT>If it is of any relevence, the spread is bound to a datasource that implements ISheetDataModel, although this seem to be working fine for visual loading editing etc.


    Any thoughts?


    Thanks,


    Chris

    </FONT></FONT>
  • Replied 8 September 2017, 12:57 pm EST

    Chris,


    I tested this with the code from the following thread and it returned the correct number of pages for me. Are you using the latest maintenance release? If so, could you post a small zipped project reproducing this issue for us to debug?

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels