Problem with PrintSheet(-1)!!!

Posted by: basti on 8 September 2017, 1:50 pm EST

  • Posted 8 September 2017, 1:50 pm EST

    Hello together!


    I have following problem:


    I have a spread with for example 15 sheets. All of these sheets are having different rowcounts.


    When I'm trying to print all those sheets via FPSpread.<FONT size=2>PrintSheet(-1) then it prints all sheets, but <FONT style="BACKGROUND-COLOR:#ffff00;">only one page</FONT> of each sheet.</FONT>


    The problem is, that the first sheet may have data for only one page, but the second and the third may have data for more then one page.


    Why is it only printing one page per sheet and not all pages of each sheet?


    Do I have to set some printinformation, or what is wrong?


    Please help me as soon as possible.... it is realy urgent for our customers!


     


    Thanks in advance!


     


    (Im using 4.0.2009.2005 for .NET Framework 2.0)<FONT size=2>

    </FONT>
  • Replied 8 September 2017, 1:50 pm EST

    Hello Basti,

    Regarding the reported issue, have you also trying using the PrinInfo object and then setting different printer settings based on your requirements. Using PrintInfo objet will require you to set the PrintInfo object to different pages. You can print all or some of the pages for the sheet. Specify the pages to print by setting the PrintType, PageStart, and PageEnd properties of the PrintInfo object.You can calculate the number of printed pages for the sheet using the GetPrintPageCount method. Below snippet prints pages 5 through 10 for Sheet(0)

    <blockquote>

    Dim printset As New FarPoint.Win.Spread.PrintInfo()

    printset.PrintType =
    FarPoint.Win.Spread.PrintType.PageRange

    printset.PageStart = 5

    printset.PageEnd = 10

    FpSpread1.Sheets(0).PrintInfo = printset

    FpSpread1.<font color="#ffffff">PrintSheet</font>(0)

    </blockquote>

    In case you have many sheets in your project, then you may set the printer specific properties using PrintInfo object and set the same to different sheets of SPread. Alternatively you may also use a different approach to print different number of pages in sheets using the OwnerPrintDraw method, which makes use of <font face="Tahoma" size="2"><font size="2"><font size="2">HasMorePages property to print more pages in a sheet. A detail description is given at the following thread. Hope this helps.Thanks</font></font></font>

  • Replied 8 September 2017, 1:50 pm EST

    It would help us to see the exact code you are using to set up and print your sheets as well as any code you may have in Spread events.


     


     

  • Replied 8 September 2017, 1:50 pm EST

    I tryed a few things and I found out, that everything works correct with the old FarPoint version!
    The newest version (Im using 4.0.2009.2005 for .NET Framework 2.0 now) has those errors witch I described!


    So it can't be my coding because it worked with the old version!


     


     

    <FONT size=2>

    </FONT><FONT color=#0000ff size=2>Private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Sub</FONT><FONT size=2> printf()


    frmMDI.Cursor = Cursors.WaitCursor


    </FONT><FONT color=#0000ff size=2>Dim</FONT><FONT size=2> pi </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>New</FONT><FONT size=2> FarPoint.Win.Spread.PrintInfo


    </FONT><FONT color=#0000ff size=2>Dim</FONT><FONT size=2> p </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>New</FONT><FONT size=2> System.Windows.Forms.PrintDialog


    sprMonatsuebersicht.Visible = </FONT><FONT color=#0000ff size=2>False

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>If</FONT><FONT size=2> p.ShowDialog = Windows.Forms.DialogResult.OK </FONT><FONT color=#0000ff size=2>Then

    </FONT><FONT size=2>

    sprMonatsuebersicht.Visible = </FONT><FONT color=#0000ff size=2>True

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>Dim</FONT><FONT size=2> i </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Integer

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>For</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>To</FONT><FONT size=2> sprMonatsuebersicht.Sheets.Count - 1


    </FONT><FONT color=#0000ff size=2>If</FONT><FONT size=2> i = 0 </FONT><FONT color=#0000ff size=2>And</FONT><FONT size=2> Massendruck = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then

    </FONT><FONT size=2>

    </FONT><FONT color=#008000 size=2>'Generieren des Deckblattes:

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>Dim</FONT><FONT size=2> abt, monat </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>String

    </FONT><FONT size=2>

    </FONT><FONT color=#008000 size=2>'Übergabe von Monat und Abteilung an 'deckblatt',

    </FONT><FONT size=2>

    </FONT><FONT color=#008000 size=2>'damit die Daten für das Deckblatt geschrieben werden

    </FONT><FONT size=2>

    monat = sprMonatsuebersicht.Sheets(1).Cells(0, 0).Value.ToString


    abt = sprMonatsuebersicht.Sheets(1).Cells(1, 0).Value.ToString


    abt = abt.Substring(6)


    </FONT><FONT color=#008000 size=2>'Zurücksetzen des 1.Sheets der Monatsübersicht

    </FONT><FONT size=2>

    sprMonatsuebersicht.Sheets(0).Reset()


    </FONT><FONT color=#008000 size=2>'Deckblatt wird zusammengebaut und gestaltet

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>Dim</FONT><FONT size=2> deckblatt </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>New</FONT><FONT size=2> FarPoint.Win.Spread.FpSpread


    deckblatt.Sheets.Count = 1


    deckblatt.Sheets(0).ColumnCount = 1


    deckblatt.Sheets(0).RowCount = 1


    deckblatt.Sheets(0).RowHeaderVisible = </FONT><FONT color=#0000ff size=2>False

    </FONT><FONT size=2>

    deckblatt.Sheets(0).ColumnHeaderVisible = </FONT><FONT color=#0000ff size=2>False

    </FONT><FONT size=2>

    deckblatt.Sheets(0).Cells(0, 0).Border = </FONT><FONT color=#0000ff size=2>New</FONT><FONT size=2> FarPoint.Win.DoubleLineBorder(System.Drawing.SystemColors.WindowFrame)


    deckblatt.Sheets(0).Cells(0, 0).Font = </FONT><FONT color=#0000ff size=2>New</FONT><FONT size=2> Font(Font.FontFamily, 22, FontStyle.Bold)


    deckblatt.Sheets(0).Cells(0, 0).Value = </FONT><FONT color=#a31515 size=2>"Deckblatt"</FONT><FONT size=2> </FONT>


    <FONT size=2>deckblatt.Sheets(0).Cells(0, 0).HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center


    deckblatt.Sheets(0).Cells(0, 0).VerticalAlignment = FarPoint.Win.Spread.CellVerticalAlignment.Center


    deckblatt.Sheets(0).Cells(0, 0).Column.Width = 500


    deckblatt.Sheets(0).Cells(0, 0).Row.Height = 500


    </FONT><FONT size=2>sprMonatsuebersicht.Sheets(0) = deckblatt.Sheets(0)


    </FONT><FONT color=#0000ff size=2>Else

    </FONT><FONT size=2>

    pi.Printer = p.PrinterSettings.PrinterName


    pi.ZoomFactor = 90 / 100


    pi.Orientation = FarPoint.Win.Spread.PrintOrientation.Portrait


    pi.Centering = FarPoint.Win.Spread.Centering.Horizontal


    pi.Header = </FONT><FONT color=#a31515 size=2>"/fb1/fz""14"" HEADER"</FONT><FONT color=#008000 size=2>

    </FONT><FONT size=2>

    pi.HeaderHeight = 30


    pi.Footer = </FONT><FONT color=#a31515 size=2>"FOOTER"

    </FONT><FONT size=2>

    pi.Footer = pi.Footer + vbNewLine(1) + </FONT><FONT color=#a31515 size=2>" Page /p of /pc"

    </FONT><FONT size=2>

    pi.FooterHeight = 170

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If

    </FONT><FONT size=2>

    sprMonatsuebersicht.Sheets(i).PrintInfo = pi


    </FONT><FONT color=#0000ff size=2>Next

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>If</FONT><FONT size=2> Massendruck = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then

    </FONT><FONT size=2>

    </FONT><FONT color=#008000 size=2>'Alle Sheets werden gedruckt

    </FONT><FONT size=2>

    sprMonatsuebersicht.PrintSheet(-1)


    </FONT><FONT color=#0000ff size=2>Else

    </FONT><FONT size=2>

    </FONT><FONT color=#008000 size=2>'Nur Sheet(1) wird gedruckt --> Wenn eine einzelne KST gedruckt werden soll

    </FONT><FONT size=2>

    sprMonatsuebersicht.PrintSheet(1)


    </FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If

    </FONT><FONT size=2>

    frmMDI.Cursor = Cursors.Default


    </FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Sub</FONT>


     


    'I only need the following method that the first page has an other prinformation then the other pages


    <FONT size=2></FONT><FONT color=#0000ff size=2>Private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Sub</FONT><FONT size=2> sprMonatsuebersicht_PrintMessageBox(</FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> sender </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Object</FONT><FONT size=2>, </FONT><FONT color=#0000ff size=2>ByVal</FONT><FONT size=2> e </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> FarPoint.Win.Spread.PrintMessageBoxEventArgs) </FONT><FONT color=#0000ff size=2>Handles</FONT><FONT size=2> sprMonatsuebersicht.PrintMessageBox


    </FONT><FONT color=#008000 size=2>'Event ist für das Seitenlayout vor jedem Druck zuständig

    </FONT><FONT size=2>

    </FONT><FONT color=#008000 size=2>'Wird hier aber nicht angezeigt

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>If</FONT><FONT size=2> e.BeginPrinting </FONT><FONT color=#0000ff size=2>Then

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>If</FONT><FONT size=2> e.Id = 0 </FONT><FONT color=#0000ff size=2>And</FONT><FONT size=2> Massendruck = </FONT><FONT color=#0000ff size=2>True</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Then

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>Dim</FONT><FONT size=2> pi </FONT><FONT color=#0000ff size=2>As</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>New</FONT><FONT size=2> FarPoint.Win.Spread.PrintInfo


    pi.ZoomFactor = 90 / 100


    pi.Orientation = FarPoint.Win.Spread.PrintOrientation.Portrait


    pi.Centering = FarPoint.Win.Spread.Centering.Both


    pi.Header = </FONT><FONT color=#a31515 size=2>""

    </FONT><FONT size=2>

    pi.Footer = </FONT><FONT color=#a31515 size=2>""

    </FONT><FONT size=2>

    sprMonatsuebersicht.Sheets(0).PrintInfo = pi


    Massendruck = </FONT><FONT color=#0000ff size=2>False

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>If

    </FONT><FONT size=2>

    </FONT><FONT color=#0000ff size=2>End</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>Sub</FONT>


    <FONT color=#0000ff size=2></FONT> 


    <FONT color=#0000ff size=2> 

    </FONT>
  • Replied 8 September 2017, 1:50 pm EST

    Was the previous version you are referring to the previous version 4 build or an earlier version (v3 or v25)


     

Need extra support?

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

Learn More

Forum Channels