[]
        
(Showing Draft Content)

상세 행(RowDetail)을 PDF로 내보내기

그리드를 PDF로 내보낼 때 행 세부정보를 포함하려면 FlexGridPdfConverter.export 메서드 호출에 사용된 매개변수에 다음이 포함되어야 합니다:

  1. drawDetailRows 옵션이 true로 설정되어 컴포넌트가 확장된 세부 행을 위한 공간을 남기고
  2. formatItem 이벤트에는 출력 문서에 세부 정보를 렌더링하는 데 사용되는 핸들러가 있습니다.
import * as core from '@grapecity/wijmo';
import * as grid from '@grapecity/wijmo.grid';
import * as detail from '@grapecity/wijmo.grid.detail';
import * as gridPdf from '@grapecity/wijmo.grid.pdf';

gridPdf.FlexGridPdfConverter.export(theGrid, 'GridDetail.pdf', 
{
    customCellContent: true,
    drawDetailRows: true, // required to make room for the detail rows
    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: 'HtmlDeetail'
      }
    },
    formatItem: function(args) { // render the row details into the document
      if (args.panel.cellType === grid.CellType.Cell) {
        var row = args.panel.rows[args.row];
        if (row instanceof detail.DetailRow) {
          var detail = core.Control.getControl(row.detail),
            doc = args.canvas.document,
            clr = args.clientRect,
            cnr = args.contentRect;

          doc.saveState();
          args.canvas.paths.rect(clr.left, clr.top, clr.width, clr.height).clip();
          girdpdf.FlexGridPdfConverter.drawToPosition(
            detail, doc, new core.Point(cnr.left, cnr.top), null, null, {
              customCellContent: true
            });
          doc.restoreState();

          args.cancel = true;
        }
      }
    }
  }
);