Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Printing / Specifying What to Print / Printing the Portion of the Sheet with Data
In This Topic
    Printing the Portion of the Sheet with Data
    In This Topic

    You may not want to print the entire sheet but only the portion of the sheet that has data. Use the UseMax method of the PrintInfo class to specify whether to print only rows and columns containing data or whether to print all the way to the end of the defined sheet, even if the rows and columns are empty.

    If you want to print all of the columns (even if it does not have data in it) but only the rows with data, you would need to set UseMax to True to keep from printing rows without data. Then, you would need to programmatically put data in the last column and the last row with data, so the Spread prints all the columns. You could add a line of code similar to the following before calling the PrintSheet method.

    C#
    Copy Code
    fpSpread1.Sheets(0).Cells(fpSpread1.Sheets(0).GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data), (fpSpread1.Sheets(0).ColumnCount - 1)).Value = ""
    
    VB
    Copy Code
    fpSpread1.Sheets[0].Cells[fpSpread1.Sheets[0].GetLastNonEmptyRow(FarPoint.Win.Spread.NonEmptyItemFlag.Data), fpSpread1.Sheets[0].ColumnCount - 1].Value = "";
    

    For more information about methods involved with finding data, refer to Rows or Columns That Have Data.

    See Also