Declined
Last Updated: 14 Apr 2022 14:20 by Matt
Matt
Created on: 07 Apr 2022 19:01
Category: UI for Blazor
Type: Feature Request
0
Insert Gantt Chart into WordsProcessing Document

Not finding any examples or similar, so I wanted to see if there is a way to include a Gantt Chart into a WordsProcessing document. I am currently bringing the data into a table, but my end-user has requested to see the chart view of the same data.

 


if (JobMilestones.Count > 0)
        {
            editor.InsertText("MILESTONES").FontWeight = FontWeights.Bold;

            


            Table tblMilestone = editor.InsertTable(JobMilestones.Count + 1, 3);
            tblMilestone.PreferredWidth = new TableWidthUnit(720);
            Paragraph p = tblMilestone.Rows[0].Cells[0].Blocks.AddParagraph();
            tblMilestone.Rows[0].RepeatOnEveryPage = true;
            tblMilestone.Rows[0].Cells[0].Borders = tcb;
            tblMilestone.Rows[0].Cells[1].Borders = tcb;
            tblMilestone.Rows[0].Cells[2].Borders = tcb;

            editor.MoveToParagraphStart(p);
            editor.InsertText("Task").FontWeight = FontWeights.Bold;
            p = tblMilestone.Rows[0].Cells[1].Blocks.AddParagraph();
            editor.MoveToParagraphStart(p);
            editor.InsertText("Start").FontWeight = FontWeights.Bold;
            p = tblMilestone.Rows[0].Cells[2].Blocks.AddParagraph();
            editor.MoveToParagraphStart(p);
            editor.InsertText("End").FontWeight = FontWeights.Bold;
            int x = 1;
            foreach (FlatModel fm in JobMilestones)
            {
                p = tblMilestone.Rows[x].Cells[0].Blocks.AddParagraph();
                editor.MoveToParagraphStart(p);
                editor.InsertText(fm.TaskTitle);
                p = tblMilestone.Rows[x].Cells[1].Blocks.AddParagraph();
                editor.MoveToParagraphStart(p);
                editor.InsertText(fm.StartDate.ToShortDateString());
                p = tblMilestone.Rows[x].Cells[2].Blocks.AddParagraph();
                editor.MoveToParagraphStart(p);
                editor.InsertText(fm.EndDate.ToShortDateString());
                tblMilestone.Rows[x].Cells[0].Borders = tcb;
                tblMilestone.Rows[x].Cells[1].Borders = tcb;
                tblMilestone.Rows[x].Cells[2].Borders = tcb;
                x += 1;
            }
            editor.MoveToTableEnd(tblMilestone);
            //editor.InsertLine("");
            editor.InsertBreak(BreakType.LineBreak);
        }

2 comments
Matt
Posted on: 14 Apr 2022 14:19
Thanks Hristian. I had a feeling there was no direct solution available. I will look at the export options and see what I can come up with.
ADMIN
Hristian Stefanov
Posted on: 14 Apr 2022 06:50

Hi Matt,

There is one known approach that will help to achieve the desired result. At first, export the component to a PDF file. Then, get the component view from that PDF file into a WordProcessing file.

  • Here is a demo that shows how to export UI components to a PDF file - Export UI Element.
  • Here is an article that shows how to get the component view from the PDF file and insert it into the WordProcessing document - Get a component view.

The insert of Gantt directly into a WordProcessing document is not possible.

Overall, the described scenario looks more like a document processing example. That being said, I'm marking the public item with a status "Declined" as this cannot be a Blazor component enhancement.

I hope you find the above information helpful. If there is anything else we can help with, I would be glad.

Regards,
Hristian Stefanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.