[]
        
(Showing Draft Content)

FlexGrid를 PDF로 내보내기

FlexGrid 컨트롤을 PDF로 내보내려면 두 개의 추가 모듈을 어플리케이션에 포함해야 합니다:

  1. wijmo.pdf.js: PDF 파일을 저장하고 로드하는 일반적인 방법을 제공합니다.
  2. wijmo.grid.pdf.js: wijmo.pdf.js를 사용하여 FlexGrid 컨트롤을 PDF로 저장하는 FlexGridPdfConverter 클래스를 포함합니다.

FlexGrid를 PDF로 내보내려면,FlexGridPdfConverter.export 메서드를 호출하고 내보낼 그리드에 대한 참조, 파일 이름, 페이지 형식, 머리글과 바닥글, 스타일을 정의하는 추가 옵션을 제공합니다.

import * as grid from '@grapecity/wijmo.grid';
import * as pdf from '@grapecity/wijmo.pdf';
import * as gridPdf from '@grapecity/wijmo.grid.pdf';

gridPdf.FlexGridPdfConverter.export(theGrid, 'LearnWijmo.pdf', {
    maxPages: 10,
    scaleMode: gridPdf.ScaleMode.PageWidth,
    documentOptions: {
        compress: true,
        header: { declarative: { text: '\t&[Page] of &[Pages]' } },
        footer: { declarative: { text: '\t&[Page] of &[Pages]' } },
        info: { author: 'C1', title: 'Learn Wijmo' }
    },
    styles: {
        cellStyle: { backgroundColor: '#ffffff', borderColor: '#c6c6c6' },
        altCellStyle: { backgroundColor: '#f9f9f9' },
        groupCellStyle: { backgroundColor: '#dddddd' },
        headerCellStyle: { backgroundColor: '#eaeaea' }
    }
});

PDF를 수동으로 생성하고 내보낸 그리드와 원하는 기타 정보를 추가할 수도 있습니다. 그리드의 데이터가 포함된 사용자 정의 리포트 또는 문서를 생성하는 데 유용합니다.

// create the document
var doc = new pdf.PdfDocument({
    compress: true, 
    header: { declarative: { text: '\t&[Page]\\&[Pages]' } },
    ended: function (sender, args) {
        wijmo.pdf.saveBlob(args.blob, 'LearnWijmoDoc.pdf');
    }
});

// add some content
doc.drawText('This is a FlexGrid control:');

// add the grid (400pt wide)
gridPdf.FlexGridPdfConverter.draw(theGrid, doc, 400);

// finish document
doc.end();