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.

Wed Dec 27, 2017 2:19 pm

Hello,

It's possible to insert a legend under the image ?

Thank you for advance.

elysiumsecurity
 
Posts: 14
Joined: Mon Oct 09, 2017 8:15 am

Thu Dec 28, 2017 2:41 am

Hello,

Thanks for your inquiry.
In fact, our Spire.Doc supports adding captions to images, but during the test, we have found a small error and our dev team is working on it. Once the hotfix is available, I will inform you and share the related code.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Jan 08, 2018 2:40 am

Hello,

Glad to inform the issue has been resolved and please download the hotfix at http://www.e-iceblue.com/downloads/hot_fix/spire.doc-se_6.0.101.zip
Below is the code snippet for your reference.
Code: Select all
//Create a new document and add a section
Document document = new Document();
Section s = document.AddSection();

//Add image and caption
Image img1 = Image.FromFile(@"imagepath1");
DocPicture pic1 = s.AddParagraph().AppendPicture(img1);
CaptionNumberingFormat format = CaptionNumberingFormat.Number;
pic1.AddCaption("This is picture ", format, CaptionPosition.AfterImage);

Image img2 = Image.FromFile(@"imagepath2");
DocPicture pic2 = s.AddParagraph().AppendPicture(img2);
pic2.AddCaption("This is picture ", format, CaptionPosition.AfterImage);

//Update the field.
document.IsUpdateFields = true;

//Save the document to a Word file.
document.SaveToFile("caption.docx", FileFormat.Docx);


Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.Doc