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.PrintSheet(-1) then it prints all sheets, but only one page of each sheet.

    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)

  • 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)

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

    printset.PrintType =

    printset.PageStart = 5

    printset.PageEnd = 10

    FpSpread1.Sheets(0).PrintInfo = printset


    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 HasMorePages property to print more pages in a sheet. A detail description is given at the following thread. Hope this helps.Thanks

  • 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!



    Private Sub printf()

    frmMDI.Cursor = Cursors.WaitCursor

    Dim pi As New FarPoint.Win.Spread.PrintInfo

    Dim p As New System.Windows.Forms.PrintDialog

    sprMonatsuebersicht.Visible = False

    If p.ShowDialog = Windows.Forms.DialogResult.OK Then

    sprMonatsuebersicht.Visible = True

    Dim i As Integer

    For i = 0 To sprMonatsuebersicht.Sheets.Count - 1

    If i = 0 And Massendruck = True Then

    'Generieren des Deckblattes:

    Dim abt, monat As String

    'Übergabe von Monat und Abteilung an 'deckblatt',

    'damit die Daten für das Deckblatt geschrieben werden

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

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

    abt = abt.Substring(6)

    'Zurücksetzen des 1.Sheets der Monatsübersicht


    'Deckblatt wird zusammengebaut und gestaltet

    Dim deckblatt As New FarPoint.Win.Spread.FpSpread

    deckblatt.Sheets.Count = 1

    deckblatt.Sheets(0).ColumnCount = 1

    deckblatt.Sheets(0).RowCount = 1

    deckblatt.Sheets(0).RowHeaderVisible = False

    deckblatt.Sheets(0).ColumnHeaderVisible = False

    deckblatt.Sheets(0).Cells(0, 0).Border = New FarPoint.Win.DoubleLineBorder(System.Drawing.SystemColors.WindowFrame)

    deckblatt.Sheets(0).Cells(0, 0).Font = New Font(Font.FontFamily, 22, FontStyle.Bold)

    deckblatt.Sheets(0).Cells(0, 0).Value = "Deckblatt"

    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

    sprMonatsuebersicht.Sheets(0) = deckblatt.Sheets(0)


    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 = "/fb1/fz""14"" HEADER"

    pi.HeaderHeight = 30

    pi.Footer = "FOOTER"

    pi.Footer = pi.Footer + vbNewLine(1) + " Page /p of /pc"

    pi.FooterHeight = 170

    End If

    sprMonatsuebersicht.Sheets(i).PrintInfo = pi


    If Massendruck = True Then

    'Alle Sheets werden gedruckt



    'Nur Sheet(1) wird gedruckt --> Wenn eine einzelne KST gedruckt werden soll


    End If

    End If

    frmMDI.Cursor = Cursors.Default

    End Sub


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

    Private Sub sprMonatsuebersicht_PrintMessageBox(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.PrintMessageBoxEventArgs) Handles sprMonatsuebersicht.PrintMessageBox

    'Event ist für das Seitenlayout vor jedem Druck zuständig

    'Wird hier aber nicht angezeigt

    If e.BeginPrinting Then

    If e.Id = 0 And Massendruck = True Then

    Dim pi As New FarPoint.Win.Spread.PrintInfo

    pi.ZoomFactor = 90 / 100

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

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

    pi.Header = ""

    pi.Footer = ""

    sprMonatsuebersicht.Sheets(0).PrintInfo = pi

    Massendruck = False

    End If

    End If

    End Sub



  • 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