docx icon indicating copy to clipboard operation
docx copied to clipboard

Support for Charts

Open botirk38 opened this issue 7 months ago • 4 comments

Hi it would be cool to allow the creation of charts, would be happy to work on this as well although I am new on the repo, my use case is converting mermaid charts to docx charts.

botirk38 avatar Apr 21 '25 17:04 botirk38

That would be awesome

Does seem possible: https://www.datypic.com/sc/ooxml/e-draw-chart_lineChart-1.html http://officeopenxml.com/drwOverview.php#:~:text=See%20textboxes%20below.-,Charts,-A%20diagram%20is

dolanmiu avatar Apr 22 '25 21:04 dolanmiu

That would be awesome

Does seem possible: https://www.datypic.com/sc/ooxml/e-draw-chart_lineChart-1.html http://officeopenxml.com/drwOverview.php#:~:text=See%20textboxes%20below.-,Charts,-A%20diagram%20is

I will start with a PR for the line chart, although my needs extend beyond this. This is the following interface that I have sketched out., I would love to receive your feedback.

import { Document, Paragraph, LineChart } from "docx";

const doc = new Document({
  sections: [
    {
      children: [
        new Paragraph("Sales Over Time"),
        new LineChart({
          title: "Sales",
          categories: ["Jan", "Feb", "Mar"],
          series: [
            { name: "2024", values: [10, 20, 30] },
            { name: "2025", values: [15, 25, 35] },
          ],
        }),
      ],
    },
  ],
});

botirk38 avatar Apr 23 '25 09:04 botirk38

Hello, Your ideas are great and what I need, any new developments please?

wangliqiang1026 avatar May 29 '25 09:05 wangliqiang1026

Hi @botirk38 what is the status of this? Do you have a rough outline / implementation plan? Would love to assist.

woutkonings avatar Sep 08 '25 09:09 woutkonings

Chart support in this fork: https://github.com/sunertech/docx See demos folder for example

mazinsw avatar Dec 12 '25 14:12 mazinsw