Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Nov 14, 2019 2:12 pm

Hello,

I am evaluating your product for possible use within our project. Now I came across adding images, and specifically adding SVG images. I tried to add these in the same way as regular (jpeg, png) images, but to no success. Am i missing something?

Code: Select all
            using(Document doc = new Document())
            {
                var section = doc.AddSection();

                Paragraph paragraph1 = new Paragraph(doc);
                paragraph1.Format.HorizontalAlignment = HorizontalAlignment.Left;
                TextRange textRange1 = new TextRange(doc);
                textRange1.Text = "Test";
                paragraph1.ChildObjects.Add(textRange1);


                DocPicture picture = new DocPicture(doc);
                picture.LoadImage("kiwi.svg");
                paragraph1.ChildObjects.Add(picture);

                section.Body.ChildObjects.Add(paragraph1);
                doc.SaveToFile("spiretest.pdf", FileFormat.PDF);

            }

Kind regards,

René

renevantil
 
Posts: 2
Joined: Mon Sep 02, 2019 11:11 am

Fri Nov 15, 2019 2:43 am

Hi,

Thanks for your inquiry.
Sorry that Spire.Doc doesn't support adding SVG into Word file at present.
We will consider adding the new feature in our future upgrade. If there is any good news, we will let you know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Jun 19, 2023 9:05 am

Hi,

Thanks for your patience.
We are delighted to inform you that the latest version of our doc product now supports inserting SVG images. Please refer to the following code.
Code: Select all
Document document = new Document();
Section section = document.AddSection();
Paragraph paragraph = section.AddParagraph();
DocPicture picture = paragraph.AppendPicture(@"template.svg");
document.SaveToFile(@"Sample.docx", FileFormat.Docx);

Website link: https://www.e-iceblue.com/Download/download-word-for-net-now.html
Nuget Link: https://www.nuget.org/packages/Spire.Doc/11.6.1

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 999
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.Doc