[]
        
(Showing Draft Content)

GC.Spread.Sheets.Print.PrintInfo

Class: PrintInfo

Sheets.Print.PrintInfo

Table of contents

Constructors

Methods

Constructors

constructor

new PrintInfo(sheet?)

Represents the information to use when printing a Worksheet.

example

var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.bestFitColumns(true);
printInfo.orientation(GC.Spread.Sheets.Print.PrintPageOrientation.landscape);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
sheet? Worksheet

Methods

bestFitColumns

bestFitColumns(value?): any

Gets or sets whether column widths are adjusted to fit the longest text width for printing.

example

var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.bestFitColumns(true);
printInfo.orientation(GC.Spread.Sheets.Print.PrintPageOrientation.landscape);
printInfo.pageHeaderFooter({
    normal: {
        footer: {
            center: "SpreadJS"
        }
    }
});
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether column widths are adjusted to fit the longest text width for printing; otherwise, returns the print setting information.


bestFitRows

bestFitRows(value?): any

Gets or sets whether row heights are adjusted to fit the tallest text height for printing.

example

activeSheet.getCell(0,0).wordWrap(true);
activeSheet.getCell(0,0).value("The quick brown fox jumps over the lazy dog.");
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.bestFitRows(true);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether row heights are adjusted to fit the tallest text height for printing; otherwise, returns the print setting information.


blackAndWhite

blackAndWhite(value?): any

Gets or sets whether to print in black and white.

example

activeSheet.getRange(0, 0, 5, 5).backColor("red");
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.blackAndWhite(true);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether to print in black and white; otherwise, returns the print setting information.


centering

centering(value?): any

Gets or sets how the printed page is centered.

example

var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.columnStart(0);
printInfo.columnEnd(2);
printInfo.centering(GC.Spread.Sheets.Print.PrintCentering.horizontal);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? PrintCentering

Returns

any

If no value is set, returns how the printed page is centered; otherwise, returns the print setting information.


columnEnd

columnEnd(value?): any

Gets or sets the last column to print when printing a cell range.

example

var data = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["5", "Washington", "1972/8/8","80", "171"],
];
activeSheet.setArray(0, 0, data);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.columnStart(0);
printInfo.columnEnd(2);
printInfo.centering(GC.Spread.Sheets.Print.PrintCentering.horizontal);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the last column to print when printing a cell range; otherwise, returns the print setting information.


columnStart

columnStart(value?): any

Gets or sets the first column to print when printing a cell range.

example

var data = [
    ["1", "NewYork", "1968/6/8", "80", "180"],
    ["4", "NewYork", "1972/7/3", "72", "168"],
    ["5", "Washington", "1972/8/8","80", "171"],
];
activeSheet.setArray(0, 0, data);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.columnStart(2);
printInfo.columnEnd(4);
printInfo.centering(GC.Spread.Sheets.Print.PrintCentering.horizontal);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the first column to print when printing a cell range; otherwise, returns the print setting information.


differentFirstPage

differentFirstPage(value?): any

Gets or sets whether to print the different text and format of the header/footer on first page.

example

activeSheet.setArray(0, 0, new Array(60).fill(["sample text"]));
var printInfo = activeSheet.printInfo();
printInfo.differentFirstPage(true);
printInfo.pageHeaderFooter({
     first: {
         header: {
             left: "It is &A.",
             center: "&SThis is text.",
             right: "&BHeader"
         }
     }
});
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether to print the different text and format of the header/footer on first page; otherwise, returns the print setting information.


differentOddAndEvenPages

differentOddAndEvenPages(value?): any

Gets or sets whether to print the different text and format of the header/footer on odd and even pages.

example

activeSheet.setArray(0, 0, new Array(60).fill(["sample text"]));
var printInfo = activeSheet.printInfo();
printInfo.differentOddAndEvenPages(true);
printInfo.pageHeaderFooter({
     odd: {
         header: {
             left: "odd page",
             center: "page number: &P",
             right: "&BHeader"
         }
     },
     even: {
         header: {
             left: "even page",
             center: "page number: &P",
             right: "&BHeader"
         }
     }
});
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether to print the different text and format of the header/footer on odd and even pages; otherwise, returns the print setting information.


firstPageNumber

firstPageNumber(value?): any

Gets or sets the page number to print on the even pages.

example

activeSheet.setArray(0, 0, new Array(60).fill(["sample text"]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.firstPageNumber(5);
printInfo.pageHeaderFooter({
    normal: {
        header: {
            left: "page number: &N"
        }
    }
});
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the page number to print on the even pages; otherwise, returns the print setting information.


fitPagesTall

fitPagesTall(value?): any

Gets or sets the number of vertical pages to check when optimizing printing.

example

activeSheet.setArray(0, 0, new Array(60).fill(["sample text"]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.fitPagesTall(1);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the number of vertical pages to check; otherwise, returns the print setting information.


fitPagesWide

fitPagesWide(value?): any

Gets or sets the number of horizontal pages to check when optimizing the printing.

example

activeSheet.setArray(0, 0, [new Array(16).fill("A")]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.fitPagesWide(1);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the number of horizontal pages to check; otherwise, returns the print setting information.


margin

margin(value?): any

Gets or sets the margins for printing, in hundredths of an inch.

example

var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.pageHeaderFooter({
    normal: {
        header: {
            left: "Header Left",
            right: "Header Right"
        },
        footer: {
            left: "Footer Left",
            center: "Footer Center",
            right: "Footer Right"
        }
    }
});
printInfo.margin({top:75, bottom:75, left:20, right:20, header:10, footer:20});
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? PrintMargins

Returns

any

If no value is set, returns the margins for printing; otherwise, returns the print setting information.


orientation

orientation(value?): any

Gets or sets the page orientation used for printing.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2'], [1, 2], [3, 4]]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
// Specify the page orientation for printing.
printInfo.orientation(GC.Spread.Sheets.Print.PrintPageOrientation.landscape);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? PrintPageOrientation

Returns

any

If no value is set, returns the page orientation used for printing; otherwise, returns the print setting information.


pageHeaderFooter

pageHeaderFooter(value?): any

Gets or sets options to print the text and format of the custom header/footer on the page.

example

activeSheet.setArray(0, 0, new Array(60).fill(["sample text"]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.pageHeaderFooter({
     normal: {
         header: {
             left: "It is &T.",
             center: "&SThis is text.",
             right: "&BHeader"
         }
     }
});
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? IPageCustomHeaderFooterOptions

Returns

any

If no value is set, returns the options to print the text and format of the custom header/footer on the page; otherwise, returns the print setting information.


pageOrder

pageOrder(value?): any

Gets or sets the order in which pages print.

example

activeSheet.setRowCount(200);
activeSheet.setColumnCount(20);
activeSheet.setArray(0, 0, Array.from({ length: 200 }, (_, i) => [i]));
activeSheet.setArray(0, 0, [Array.from({ length: 20 }, (_, i) => i)]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.pageOrder(GC.Spread.Sheets.Print.PrintPageOrder.auto);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? PrintPageOrder

Returns

any

If no value is set, returns a value that specifies the order in which pages print; otherwise, returns the print setting information.


pageRange

pageRange(value?): any

Gets or sets the page range for printing.

example

activeSheet.setRowCount(200);
activeSheet.setArray(0, 0, Array.from({ length: 200 }, (_, i) => [i]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.pageRange("1-3");
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? string

Returns

any

If no value is set, returns a string that provides page numbers or page ranges; otherwise, returns the print setting information.}


paperSize

paperSize(value?): any

Gets or sets the paper size for printing.

example

activeSheet.setArray(0, 0, new Array(20).fill(["sample text"]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.paperSize(new GC.Spread.Sheets.Print.PaperSize(300, 300));
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? PaperSize

Returns

any

If no value is set, returns the paper size for printing; otherwise, returns the print setting information.


qualityFactor

qualityFactor(value?): any

Gets or sets the quality factor for printing.

example

activeSheet.setArray(0, 0, new Array(20).fill(["sample text"]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.qualityFactor(6);
activeSheet.printInfo(printInfo);
spread.print();

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the quality factor for printing; otherwise, returns the print setting information.


repeatColumnEnd

repeatColumnEnd(value?): any

Gets or sets the last column of a range of columns to print on the left of each page.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2']]);
activeSheet.setArray(0, 2, [Array.from({ length: 18 }, (_, i) => i)]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.repeatColumnStart(0);
printInfo.repeatColumnEnd(1);
activeSheet.printInfo(printInfo);
spread.print(); // "Title 1" and "Title 2" will be printed repeatedly on each page.

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the last column of a range of columns to print on the left of each page; otherwise, returns the print setting information.


repeatColumnStart

repeatColumnStart(value?): any

Gets or sets the first column of a range of columns to print on the left of each page.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2']]);
activeSheet.setArray(0, 2, [Array.from({ length: 18 }, (_, i) => i)]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.repeatColumnStart(0);
printInfo.repeatColumnEnd(1);
activeSheet.printInfo(printInfo);
spread.print(); // "Title 1" and "Title 2" will be printed repeatedly on each page.

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the first column of a range of columns to print on the left of each page; otherwise, returns the print setting information.


repeatRowEnd

repeatRowEnd(value?): any

Gets or sets the last row of a range of rows to print at the top of each page.

example

activeSheet.setArray(0, 0, [['Title 1'], ['Title 2']]);
activeSheet.setArray(2, 0, Array.from({ length: 60 }, (_, i) => [i]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.repeatRowStart(0);
printInfo.repeatRowEnd(1);
activeSheet.printInfo(printInfo);
spread.print(); // "Title 1" and "Title 2" will be printed repeatedly on each page.

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the last row of a range of rows to print at the top of each page; otherwise, returns the print setting information.


repeatRowStart

repeatRowStart(value?): any

Gets or sets the first row of a range of rows to print at the top of each page.

example

activeSheet.setArray(0, 0, [['Title 1'], ['Title 2']]);
activeSheet.setArray(2, 0, Array.from({ length: 60 }, (_, i) => [i]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.repeatRowStart(0);
printInfo.repeatRowEnd(1);
activeSheet.printInfo(printInfo);
spread.print(); // "Title 1" and "Title 2" will be printed repeatedly on each page.

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the first row of a range of rows to print at the top of each page; otherwise, returns the print setting information.


rowEnd

rowEnd(value?): any

Gets or sets the last row to print when printing a cell range.

example

activeSheet.setColumnCount(3);
activeSheet.setArray(0, 0, new Array(60).fill(["sample text"]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.rowStart(0);
printInfo.rowEnd(2);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the last row to print when printing a cell range; otherwise, returns the print setting information.


rowStart

rowStart(value?): any

Gets or sets the first row to print when printing a cell range.

example

activeSheet.setColumnCount(3);
activeSheet.setArray(0, 0, new Array(60).fill(["sample text"]));
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.rowStart(0);
printInfo.rowEnd(2);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns the first row to print when printing a cell range; otherwise, returns the print setting information.


showBorder

showBorder(value?): any

Gets or sets whether to print an outline border around the entire control.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2'], [1, 2], [3, 4]]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.showBorder(false);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether to print an outline border around the entire control; otherwise, returns the print setting information.


showColumnHeader

showColumnHeader(value?): any

Gets or sets whether to print the column header.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2'], [1, 2], [3, 4]]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.showColumnHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? PrintVisibilityType

Returns

any

If no value is set, returns whether to print the column header; otherwise, returns the print setting information.


showGridLine

showGridLine(value?): any

Gets or sets whether to print the grid lines.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2'], [1, 2], [3, 4]]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.showGridLine(true);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether to print the grid lines; otherwise, returns the print setting information.


showRowHeader

showRowHeader(value?): any

Gets or sets whether to print the row header.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2'], [1, 2], [3, 4]]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.showRowHeader(GC.Spread.Sheets.Print.PrintVisibilityType.hide);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? PrintVisibilityType

Returns

any

If no value is set, returns whether to print the row header; otherwise, returns the print setting information.


useMax

useMax(value?): any

Gets or sets whether to print only rows and columns that contain data.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2'], [1, 2], [3, 4]]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.useMax(false);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? boolean

Returns

any

If no value is set, returns whether to print only rows and columns that contain data; otherwise, returns the print setting information.


watermark

watermark(value?): any

Gets or set all watermark.

example

// This example shows how to set watermark.
var printInfo = activeSheet.printInfo();
printInfo.watermark([{x:0, y:0, width:100, height:100, imageSrc:".image/watermark.jpg", page:"all"}]);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? IWatermarkItem[]

Returns

any

The watermark item.


zoomFactor

zoomFactor(value?): any

Gets or sets the zoom factor used for printing.

example

activeSheet.setArray(0, 0, [['Title 1', 'Title 2'], [1, 2], [3, 4]]);
var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
printInfo.zoomFactor(2);
activeSheet.printInfo(printInfo);
spread.print(0);

Parameters

Name Type
value? number

Returns

any

If no value is set, returns a value that specifies the amount to enlarge or reduce the printed worksheet; otherwise, returns the print setting information.