none
how to insert a picture inside the table cell from excel to word document using openxml sdk RRS feed

  • Question

  • how to insert a picture inside the table cell from excel to word document using openxml sdk
    and also how to increase the width and height of the particular cell and row using open xml

    thanks !

    Banupriya V K

    Tuesday, May 28, 2013 4:37 AM

Answers

  • i inserted image in the word document but i need to insert it with in the table cel .

    i got the solution !!!!

    v need to change the sibling element to tc. then it ll insert dynamically.

    if (txt.Text.Contains("RFPImage_")){string[] textLines = txt.Text.Split(new string[] { "RFPImage_" }, StringSplitOptions.RemoveEmptyEntries);if (textLines.Length > 0){

    if (textLines[0].Contains(",")){string[] textLinesSPlitcomma = textLines[0].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);}else{

    string fileName = Server.MapPath("~/Source/Images/") + textLines[0].ToString();

    MainDocumentPart mainPart = activedoc.MainDocumentPart;ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Jpeg);using (FileStream stream = new FileStream(fileName, FileMode.Open)){imagePart.FeedData(stream);}tc.RemoveAllChildren();AddImageToBodyBasedOnSize(activedoc, mainPart.GetIdOfPart(imagePart), mainPart,tc); }}}}table.Append(tr);}nRun.Append(table);pp.Append(nRun);sliblingElement.InsertBeforeSelf(pp);}}


    banupriya

    • Marked as answer by Banupriya V K Wednesday, June 12, 2013 10:29 AM
    Thursday, June 6, 2013 12:01 PM

All replies

  • Hello,

    I have moved this thread to Open XML Format SDK forum for better response.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, May 29, 2013 2:22 AM
  • Wednesday, May 29, 2013 12:47 PM
  • thank you !
    Monday, June 3, 2013 11:13 AM
  • i inserted image in the word document but i need to insert it with in the table cel .

    i got the solution !!!!

    v need to change the sibling element to tc. then it ll insert dynamically.

    if (txt.Text.Contains("RFPImage_")){string[] textLines = txt.Text.Split(new string[] { "RFPImage_" }, StringSplitOptions.RemoveEmptyEntries);if (textLines.Length > 0){

    if (textLines[0].Contains(",")){string[] textLinesSPlitcomma = textLines[0].Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);}else{

    string fileName = Server.MapPath("~/Source/Images/") + textLines[0].ToString();

    MainDocumentPart mainPart = activedoc.MainDocumentPart;ImagePart imagePart = mainPart.AddImagePart(ImagePartType.Jpeg);using (FileStream stream = new FileStream(fileName, FileMode.Open)){imagePart.FeedData(stream);}tc.RemoveAllChildren();AddImageToBodyBasedOnSize(activedoc, mainPart.GetIdOfPart(imagePart), mainPart,tc); }}}}table.Append(tr);}nRun.Append(table);pp.Append(nRun);sliblingElement.InsertBeforeSelf(pp);}}


    banupriya

    • Marked as answer by Banupriya V K Wednesday, June 12, 2013 10:29 AM
    Thursday, June 6, 2013 12:01 PM