wordpress hit counter
Re: Add Image - SpreadsheetML - Formats - OpenXML Developer

Re: Add Image

Formats

Discussions about working with different Open XML Formats

Add Image

  • rated by 0 users
  • This post has 2 Replies |
  • 0 Followers
  • Hello,

    I am using the following code:

    ImagePart imagePart = spreadSheet.WorkbookPart.WorksheetParts.First().Worksheet.WorksheetPart.AddImagePart(ImagePartType.Jpeg, "img1");

    string sImagePath = @"C:\LOGO00002.jpg";
    using (FileStream fs = new FileStream(sImagePath, FileMode.Open))
    {
    imagePart.FeedData(fs);
    }

    It adds the image on the package, but it is not displayed.

    What's missing for it to be displayed?
  • Hi Vento,

    A little late but I have been working on a similar problem, the above code will add an image part to the package and write the file but its doesnt display the image, there is a good blog here on it

    http://hastobe.net/blogs/stevemorgan/archive/2008/09/15/howto-insert-an-image-into-a-word-document-and-display-it-using-openxml.aspx

    Cheers,

    Jay
  • you will need drawingML , and for spreadsheet you may need to choose oneCellAnchor, twoCellAnchor ... etc.


Page 1 of 1 (3 items)