Color scheme: Dark
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library how-to guides » How to: Export the chart

How to: Export the chart

Share a plan with people who don't have Access: as an Excel workbook that looks like the chart and still calculates, as an image, as a PDF, or as data for other programs. You don't need Excel or a PDF printer, and the exports work with the Access Runtime.

Requires WKL Forms Object Library 1.23 or later.

Solution overview

The `WklTreeList` exports include the chart. ExportToXlsx with wemWysiwyg writes the timeline as worksheet cells to the right of the list; the data exports (wemDataAware, ExportToXml, and ExportToJson) add the schedule values and the dependencies. ExportToImage and ExportToPdf draw the chart, and ExportToFile picks the format from the file name extension, including .pdf and image extensions. Users get the same options with Export … on the shortcut menu.

Implementation

With Me!Gantt1.Object
    .ExportToXlsx "Plan.xlsx", wemWysiwyg, AutoStart:=True   ' timeline as cells
    .ExportToXlsx "Plan-Data.xlsx"                            ' start, finish, duration, progress, predecessors
    .ExportToJson "Plan.json"                                 ' records and "links" (dependencies)
    .ExportToImage "Plan.png"                                 ' the whole project
    .ExportToImage "Now.png", wgrVisible                      ' what the timeline shows now
    .ExportToPdf "Plan.pdf", AutoStart:=True                  ' A4 landscape
    .ExportToFile "Plan.pdf"                                  ' format by extension
End With

Remarks

  • Excel as shown: one column per Zoom unit, the timescale as merged header cells, bars as filled cells (the completed part in the bar color, the rest lighter; critical tasks in CriticalColor), summary tasks as a thick line, milestones as ◆, nonworking days shaded, and the RightTextField text (or the resources) next to the bar. A unit is filled if the bar covers any part of it, so half a day fills a whole day column. Dates remain date values. Dependency arrows, baselines, and deadlines can't be represented in cells and are omitted. The timeline is limited to 4,000 columns; for long schedules at a fine zoom level, choose a coarser Zoom or a shorter period (ChartStart, ChartFinish).
  • Data: start, finish, duration, progress, predecessors, and resources are added as columns only if no list column already shows them.
  • Image and PDF include every record the list shows (expanded nodes, filter) and all of its columns. The PDF draws the chart at up to twice the screen resolution, scales it down to as little as half size to fit the page width, and continues a wider chart on additional pages, repeating the list. Text is part of the image: sharp when printed, but not searchable.
  • The wgrVisible period requires the form to be open in Form view; otherwise, the whole project is exported.
en/wiki/msaccess/comctl/how-to/export-the-chart.txt · Last modified: by Wolfgang van der Stille