Print and View Options

Following example shows how to specify worksheet print and view options.

Excel print and view options set with GemBox.Spreadsheet for Java
Screenshot of Excel print and view options set with GemBox.Spreadsheet for Java
import com.gembox.spreadsheet.*;

class Program {

    public static void main(String[] args) throws {
        // If using Professional version, put your serial key below.

        ExcelFile workbook = new ExcelFile();
        ExcelWorksheet worksheet = workbook.addWorksheet("Print and View Options");

        worksheet.getCell("M1").setValue("This worksheet shows how to set various print related and view related options.");
        worksheet.getCell("M2").setValue("To see results of print options, go to Print and Page Setup dialogs in MS Excel.");
        worksheet.getCell("M3").setValue("Notice that print and view options are worksheet based, not workbook based.");

        // Print options:
        ExcelPrintOptions printOptions = worksheet.getPrintOptions();

        // View options:

        // Set print area
        worksheet.getNamedRanges().setPrintArea(worksheet.getCells().getSubrange("E1", "U7"));"Print and View Options.%OutputFileType%");

Want more?

Next example GitHub

Check the next example or select an example from the menu. You can also download our examples from the GitHub.

Like it?

Download Buy

If you want to try the GemBox.Spreadsheet for Java yourself, you can download the free version. It delivers the same performance and set of features as the professional version, but with some operations limited. To remove the limitation, you need to purchase a license.