SpreadJS 13
GC.Spread.Sheets.Print Namespace / PrintInfo type / bestFitColumns Method
Whether column widths are adjusted to fit the longest text width for printing.
In This Topic
    bestFitColumns Method
    In This Topic
    Gets or sets whether column widths are adjusted to fit the longest text width for printing.
    Syntax
    var instance = new GC.Spread.Sheets.Print.PrintInfo();
    var returnValue; // Type: any
    returnValue = instance.bestFitColumns(value);
    function bestFitColumns( 
       (optional) value : boolean
    ) : any;

    Parameters

    value
    Whether column widths are adjusted to fit the longest text width for printing.

    Return Value

    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.
    Example
    This example prints the sheet.
    activeSheet.setRowCount(3, GC.Spread.Sheets.SheetArea.viewport);
    activeSheet.setColumnCount(3, GC.Spread.Sheets.SheetArea.viewport);
    
    activeSheet.suspendPaint();
                //set value
                for (var r = 0, rc = activeSheet.getRowCount(); r < rc; r++) {
                    for (var c = 0, cc = activeSheet.getColumnCount(); c < cc; c++) {
                        activeSheet.setValue(r, c, r + c);
                    }
                }
    activeSheet.resumePaint();
    
    $("#button1").click(function () {
    var printInfo = new GC.Spread.Sheets.Print.PrintInfo();
    printInfo.bestFitColumns(true);
    printInfo.orientation(GC.Spread.Sheets.Print.PrintPageOrientation.landscape);
    printInfo.footerCenter("GrapeCity");
    activeSheet.printInfo(printInfo);
    spread.print(0);
       });
    See Also

    Reference

    PrintInfo type