Spire.Presentation is a professional PowerPoint® compatible library that enables developers to create, read, write, modify, convert and Print PowerPoint documents. Get free and professional technical support for Spire.Presentation for .NET, Java, Android, C++, Python.

Wed Jul 25, 2018 1:10 pm

Hi,

I'm trying to save presentation into SVG, and have problems with datalabels in Chart.
While on pptx everything looks fine in svg there are a lot of issues:
- No border
- No leader lines
- Size of data label is different
- No paragraphs and text is shifted together
- No background color

Please refer to this code snippet:
Code: Select all
        static void Main(string[] args)
        {
            var presentation = new Presentation();
            var slide = presentation.Slides[0];

            var chart = slide.Shapes.AppendChart(ChartType.ScatterStraightLinesAndMarkers, new RectangleF(50, 50, 500, 500));

            ChartDataLabel cd = chart.Series[0].DataLabels.Add();
            cd.X = -0.40f;
            cd.Y = -0.25f;
            cd.ID = 2;
            cd.TextFrame.Paragraphs[0].Text = "hello";
            cd.TextFrame.Paragraphs.Append(new TextParagraph() {Text = "second line"});
            cd.TextFrame.Paragraphs.Append(new TextParagraph() { Text = "third line" });

            cd.Fill.FillType = FillFormatType.Solid;
            cd.Fill.SolidColor.Color = Color.FromArgb(200, Color.Red);

            cd.Line.FillFormat.FillType = FillFormatType.Solid;
            cd.Line.FillFormat.SolidFillColor.Color = Color.FromArgb(55, 96, 146);

            cd.LabelValueVisible = true;

            chart.Series[0].DataLabels.LeaderLinesVisible = true;

            presentation.SaveToFile("D://test.pptx", FileFormat.Pptx2013);
            var svgBytes = presentation.SaveToSVG();
            int len = svgBytes.Count;

            for (int i = 0; i < len; i++)
            {
                FileStream fs = new FileStream($"D://result{i}.svg", FileMode.Create);

                byte[] bytes1 = svgBytes.Dequeue();
                fs.Write(bytes1, 0, bytes1.Length);
            }

            Process.Start("D://test.pptx");
            Process.Start("D://result0.svg");
        }

Stecya
 
Posts: 27
Joined: Wed Jan 10, 2018 2:36 pm

Thu Jul 26, 2018 3:35 am

Hi Stecya,

Thanks for your inquiry.
I have reproduced the issues and posted them to our Dev team.. I will let you know if there is any update. Sorry for the inconvenience caused.
Sincerely,
Hogan
E-iceblue support team
User avatar

hogan.tang
 
Posts: 51
Joined: Tue Jul 03, 2018 1:43 am

Wed Aug 01, 2018 11:18 am

Hi,

Any updates or ETA on this one?

Regards

Stecya
 
Posts: 27
Joined: Wed Jan 10, 2018 2:36 pm

Thu Aug 02, 2018 1:13 am

Hi Stecya,

Thanks for your inquiry.
Sorry that there is no ETA at present. However we have requested our development team to share an ETA at their earliest. We will update you as soon as we get a feedback.
Sincerely,
Hogan
E-iceblue support team
User avatar

hogan.tang
 
Posts: 51
Joined: Tue Jul 03, 2018 1:43 am

Fri Aug 17, 2018 2:10 am

Dear Stecya,

Glad to inform that your issue has been fixed in the latest Spire.presentation version(Spire.Presentation Pack Hotfix Version:3.8.4)
Sincerely,
Hogan
E-iceblue support team
User avatar

hogan.tang
 
Posts: 51
Joined: Tue Jul 03, 2018 1:43 am

Tue Sep 04, 2018 7:57 am

Hi Stecya,

Have you tried the hotfix? Could you please give us some feedback at your convenience?
Sincerely,
Hogan
E-iceblue support team
User avatar

hogan.tang
 
Posts: 51
Joined: Tue Jul 03, 2018 1:43 am

Tue Sep 04, 2018 2:21 pm

Hi,

I have checked your hotfix and while it did fix some visual issues there are still more to come

1. The font size is not correct, for all text.
2. Font style is not correct. I'm setting some parts of text into bold and it doesn't get rendered into SVG
3. Text alignment is not working

And I think there are more related to text look and feel, those three are just enough for us to make export into SVG not viable option for now.

Please check code snippet. Hope it wont take long to fix this

Code: Select all
        static void Main(string[] args)
        {
            var presentation = new Presentation();
            var slide = presentation.Slides[0];

            var chart = slide.Shapes.AppendChart(ChartType.ScatterStraightLinesAndMarkers, new RectangleF(50, 50, 500, 500));

            ChartDataLabel cd = chart.Series[0].DataLabels.Add();
            cd.X = -0.40f;
            cd.Y = -0.25f;
            cd.ID = 2;
            cd.TextFrame.Paragraphs.Clear();
            cd.TextFrame.Paragraphs.Append(CreateHeader("hello"));
            cd.TextFrame.Paragraphs.Append(CreateParagraph("second line"));
            cd.TextFrame.Paragraphs.Append(CreateParagraph("third line"));

            cd.Fill.FillType = FillFormatType.Solid;
            cd.Fill.SolidColor.Color = Color.FromArgb(200, Color.Red);

            cd.Line.FillFormat.FillType = FillFormatType.Solid;
            cd.Line.FillFormat.SolidFillColor.Color = Color.FromArgb(55, 96, 146);

            cd.LabelValueVisible = true;

            chart.Series[0].DataLabels.LeaderLinesVisible = true;

            presentation.SaveToFile("D://test.pptx", FileFormat.Pptx2013);
            var svgBytes = presentation.SaveToSVG();
            int len = svgBytes.Count;

            for (int i = 0; i < len; i++)
            {
                FileStream fs = new FileStream($"D://result{i}.svg", FileMode.Create);

                byte[] bytes1 = svgBytes.Dequeue();
                fs.Write(bytes1, 0, bytes1.Length);
            }

            Process.Start("D://test.pptx");
            Process.Start("D://result0.svg");
        }

        public static TextParagraph CreateParagraph(string text)
        {
            var paragraph = new TextParagraph
            {
                Alignment = TextAlignmentType.Left,
                Text = text
            };
            paragraph.FirstTextRange.Format.FontHeight = 8;

            return paragraph;
        }

        public static TextParagraph CreateHeader(string text)
        {
            var paragraph = CreateParagraph(text);

            paragraph.FirstTextRange.IsBold = TriState.True;
            return paragraph;
        }

Stecya
 
Posts: 27
Joined: Wed Jan 10, 2018 2:36 pm

Wed Sep 05, 2018 6:22 am

Dear Stecya,

Thanks for your post.
I did notice the issues you described, and logged them into our bug tracking system with a high priority. If there is any update, we will let you know, sorry for the inconvenience caused.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1271
Joined: Wed Apr 25, 2018 3:20 am

Fri Sep 21, 2018 9:07 am

Dear Stecya,

Glad to inform that your described issues have been resolved in the hotfix Spire.Presentation Pack Hotfix Version:3.9.5. Welcome to test it and any feedback will be greatly appreciated.

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1271
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.Presentation