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.

Mon Apr 25, 2016 8:01 am

Hi,
When I insert a picture into a new paragraph and then insert the new paragaraph to a dot file ,an error occured. Below is the codes:
Code: Select all
private void AppendGraphic(string picFileName, String dotfile)
        {
            Document document = new Document();
            document.LoadFromFile(dotfile);

            Debug.WriteLine(document.Sections.Count);
            Paragraph para2 = new Paragraph(document);
           
            para2.AppendPicture(Image.FromFile(picFileName));

            Paragraph para = document.LastSection.Paragraphs[5];
            int curIndex = document.LastSection.Body.ChildObjects.IndexOf(para);
            document.LastSection.Body.ChildObjects.Insert(curIndex, para2);
           
            //new paragarph after the picture paragraph
            Paragraph para1 = document.LastSection.Paragraphs[1];
            para1.AppendText("a paragraph after the picture paragraph");
            curIndex = document.LastSection.Body.ChildObjects.IndexOf(para2);
            document.LastSection.Body.ChildObjects.Insert(curIndex, para1);
            //Save doc file.
            document.SaveToFile("Sample.doc", FileFormat.Doc);

            //Launching the MS Word file.
            WordDocViewer("Sample.doc");
        }


and I will send the .dot file that cause an error in it .

iceblueDDX123
 
Posts: 34
Joined: Tue Apr 19, 2016 9:43 am

Mon Apr 25, 2016 8:54 am

Hello,

Thanks for your information.
I tested your file with your code and the latest version Spire.Doc Pack(hot fix) Version:5.6.62. There was not error here. Could you please share your error information with us for investigation?

Thanks and Best Regards,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Mon Apr 25, 2016 9:22 am

caroline.zhang wrote:Hello,

Thanks for your information.
I tested your file with your code and the latest version . There was not error here. Could you please share your error information with us for investigation?

Thanks and Best Regards,
Caroline
E-iceblue support team

I have used the 5.6.62 version ,Could you send you demo ? 1292680719@qq.com

iceblueDDX123
 
Posts: 34
Joined: Tue Apr 19, 2016 9:43 am

Mon Apr 25, 2016 9:40 am

Hi,

I have sent to your email, please check.

Sincerely,
Caroline
E-iceblue support team
User avatar

caroline.zhang
 
Posts: 291
Joined: Mon Mar 07, 2016 9:22 am

Tue Apr 26, 2016 3:29 am

Hi,

Line spacing of the sixth paragraph in your original dot document is set as Exactly 15.8pt. The height of the inserted picture is greater than 15.8pt, so the the picture appeared partially. I recommend you to set the line spacing as Single and the picture will appear completely.
Original setting
original spacing.png

Recommending setting.
changed.png


Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc