OpenXML Images added with AddImagePart not showing up in the document

Did you solve this issue?
I'm trying to add an image to an existing Word 2010 document using OpenXML SDK 2.5. But when I add the image the image does not get embedded. When I open the document, the image shows the placeholder with a red cross (as if the image cannot be found). I'm
using the following code:
string mimetype = String.Empty;
//Find mime type of the image here
imagePart = wpd.MainDocumentPart.AddImagePart(mimetype);
using (FileStream stream = new FileStream(filename, FileMode.Open))
image = new Bitmap(stream);
cy = Convert.ToUInt32(image.PhysicalDimension.Height);
cx = Convert.ToUInt32(image.PhysicalDimension.Width);
imagePart.FeedData(stream);
stream.Close();
Paragraph para = FindParagraphInAppendix(....); //Find the paragraph to add
if (para != null)
AddImageToParagraph(para, wpd.MainDocumentPart.GetIdOfPart(imagePart),txt, filename,cx,cy);
else
wpd.MainDocumentPart.Document.Body.Append(GetImageWithPara(wpd.MainDocumentPart.GetIdOfPart(imagePart), filename, cx, cy));
wpd.Package.CreateRelationship(imagePart.Uri, System.IO.Packaging.TargetMode.External,wpd.MainDocumentPart.GetIdOfPart(imagePart));
wpd.MainDocumentPart.Document.Save();
In the code for AddImageToParagraph I'm adding the image as follows:
Pic.BlipFill blipFill1 = new Pic.BlipFill();
A.Blip blip1 = new A.Blip() { Embed = relationshipid,
CompressionState = A.BlipCompressionValues.Print };
A.BlipExtensionList blipExtensionList1 = new A.BlipExtensionList();
When I open the file generated using Winzip, the document.xml.rels file does not contain a relationship ID associated with the embedded image.
When I open the using OpenXML Productivity tool and validate the XML I get the error : "The relationship 'R75a8cc179...' referenced by attribute 'hxxp://schemas.openxmlformats..../relationships:embed' does not exist
But what strikes as odd is imagePart.AddImagePart is not creating a
<Relationship> tag in the resulting document.xml.rels.
Using a debugger and stepping through, I checked the output of wpd.GetReferenceRelationship(wpd.MainDocumentPart.GetIdOfPart(imagePart)) and it throws a System.Generic.Collections.KeyNotFoundException.
Can you help?

Hello,
This is SQL Database froum. Since your question is related to Office Development, I suggest you post the question in the following froum.
Word for Developers:
http://social.msdn.microsoft.com/Forums/office/en-us/home?forum=worddev&filter=alltypes&sort=lastpostdesc
It is more appropriate and more expert will assist you.
Regards,
Fanny Liu
If you have any feedback on our support, please click
here.
Fanny Liu
TechNet Community Support

Similar Messages

  • HT3180 Anyone having trouble with Netflix not showing up in the internet menu?  I am trying to do a reset, but it says it can't download latest updates try again later.

    Anyone having trouble with Netflix not showing up on the Internet Menu?  I have tried to do a reset and then restore, but it says that "the latest update download cannot be done at this time, try again later"

    If your problem persists get yourself a micro USB cable (sold separately), you can restore your Apple TV from iTunes:
    Remove ALL cables from Apple TV. (if you don't you will not see Apple TV in the iTunes Source list)
    Connect the micro USB cable to the Apple TV and to your computer.
    Open iTunes.
    Select your Apple TV in the Source list, and then click Restore.

  • I made a Photo Book in Lightroom 5.5 converted to jpg and tried to upload to Shutterfly. The only page that I had text added in will not show up in the online Book!!  Thanks For Your Help,  Scott

    I Made a Photo Book in Lightroom 5.5 converted to jpg and tried to upload to Shutterfly. The only page that had text added in will not show up in the online Book!!!  Help,  Scott

    There's a whole lot to read in your post, and frankly I have not read it all.
    Having said that, this troubleshooting guide should help:
    http://support.apple.com/kb/TS1538
    In particular, pay attention to the mobile device support sections near the bottom, assuming you have already done the items above it.

  • Added fields does not show up in the RSA6

    Hello.
    Problem 1:
    I am enhancing 0bbp_td_sc_1. I added a field to the structure, but it does not show up in the rsa6. ( I double clicked on the extractor name).  If I go to the extractor structure (BBP_SC_BW_GET_TD_STRUC), I am able to see the append. The structure is activated. The append structure is also activated (Zabbp_sc_bw_get_td_struc).
    What can be wrong? I did not see the added the field in the ROOSFIELD table either.
    Problem 2:  What is the difference If I populated the field value from “RSU5_SAP_BADI” to the rsap001 user exit “EXIT_SAPLRSAP_001”?
    I am not able to run debug RSU5_SAP_BADI. STOP does not stop. While I debug, I am able to see the field ( The field I added from problem 1). But the value never populated.
    I am able to run the debug for EXIT_SAPLRSAP_001. I see the data populated for the field. But in RSA3 result, I am not able to see it.
    Thanks in advance.

    Hi
    1. this is usualy the case if the append struct is not active or you did not add the new fields in the append struct.
    I would suggest to remove the fields save activate and re do the process making sure you either use an existing append struct or create a new one.
    2. BADI are different then UE in the way they are implemented.  I will recommend using UE.
    You will not see the enhanced fields in the out put of RSA3 so I stop on the last line and check the values in the struct.
    to debug I would either go to the UE (in a different session) and put a break point there and run RSA3 or check the debug in RSA3 and then find the SAPEXIT that calls the UE.
    I hope this helps.
    Reg's
    Edan

  • Spry Image Slideshow with Filmstrip not showing online

    I just put up an image slideshow. It works locally, but online the spinning wheel spins all the time. The viewport does not show any image. The filmstrip does show the thumbnails, and the navigation works. My guess is that the images I used for the viewport (a href) are too large? Their size is generally 700x580 and mostly above 90KB - are they too big??
    Here's the link: http://webdesign.mpcc.edu/KenShobe/DaphneM/WebII/lane_photography/submenu/flora.html
    I greatly appreciate your help!

    Well, the images were not too big - resolution wise. What I did was I checked my remote server files and made sure that it was identical to my local files for my website. And I found out that Dreamweaver did not upload the images (the ones that go into the a href tag) into my remote server, though I "put the entire site." SO I had to upload them. And then when I checked it worked.
    Hope this is helpful.

  • HT5731 I have an iPhone 4S and when I sync it, the "purchased" and "recently added" playlists do not show up on my phone.

    I have an iPhone 4S and when I sync it, the "purchased" and "recently added" playlists do not show up on my phone. For some reason I can't get all the playlists I have set up in iTunes to show up on my phone. 

    Hi HipstaTrinty,
    Welcome to the Support Communities!
    The article below may be able to help you with this.  Click on the link to see more details and screenshots. 
    If you can't update or restore your iOS device
    http://support.apple.com/kb/ht1808
    Cheers,
    - Judy

  • I've a new account on iMac.  When composing an email the contact list does not show up on the bar.  WWhen I start keying in a name, it comes up with the address.  How do I engage the  contact list from the email?

    I've a new account on iMac.  When composing an email the contact list does not show up on the bar, which would allow me to select the persons I want to include on the distribution of the email.  When I start keying in a name in the email, it comes up with the person's address, which shows it is synced.  How do I engage the contact list from the email like I do on my old account (where a contact list icon shows up, along with the "attach" and other icons) ?

    With the New Message window open, go to the View menu and select "Customize Toolbar...".
    In the screen that opens, drag the item labelled "Address" into the Toolbar area of the New Message window, then click the "Done" button.
    That item should be then added to the Toolbar for the New Message window.
    Note that the main Mail window and the New Message window (as well as the separate message window if you open a message that way) use different toolbars - the settings/inclusions for one do not carry over to another.

  • My itunes in pc fails to secure link with itunes store it shows the process bar it automatically quits the process it also does not shows any on the screen. i am using windows xp service pack 3. what shoul i do?

    my itunes in pc fails to secure link with itunes store it shows the process bar it automatically quits the process it also does not shows any on the screen. i am using windows xp service pack 3. what shoul i do?
    Diagnostics test
    Microsoft Windows XP Professional Service Pack 3 (Build 2600)
    ECS G31T-M7
    iTunes 10.5.2.11
    QuickTime 7.6.9
    FairPlay 1.13.37
    Apple Application Support 2.1.6
    iPod Updater Library 10.0d2
    CD Driver 2.2.0.1
    CD Driver DLL 2.1.1.1
    Apple Mobile Device 4.0.0.97
    Apple Mobile Device Driver 1.57.0.0
    Bonjour 3.0.0.10 (333.10)
    Gracenote SDK 1.9.5.502
    Gracenote MusicID 1.9.5.115
    Gracenote Submit 1.9.5.143
    Gracenote DSP 1.9.5.45
    iTunes Serial Number 0012ABAC07F3CCB0
    Current user is an administrator.
    The current local date and time is 2011-12-31 14:06:21.
    iTunes is not running in safe mode.
    WebKit accelerated compositing is enabled.
    HDCP is not supported.
    Core Media is not supported. (16005)
    Video Display Information
    Intel(R) G33/G31 Express Chipset Family
    **** External Plug-ins Information ****
    No external plug-ins installed.
    **** Network Connectivity Tests ****
    Network Adapter Information
    Adapter Name:        {7599FAD1-1BB9-4AC6-80AF-404253DC519E}
    Description:            Atheros L2 Fast Ethernet 10/100 Base-T Controller - Packet Scheduler Miniport
    IP Address:             192.168.1.5
    Subnet Mask:          255.255.255.0
    Default Gateway:    192.168.1.1
    DHCP Enabled:      Yes
    DHCP Server:         192.168.1.1
    Lease Obtained:     Sat Dec 31 13:46:09 2011
    Lease Expires:       Tue Jan 03 13:46:09 2012
    DNS Servers:         192.168.1.1
    Active Connection: LAN Connection
    Connected:             Yes
    Online:                    Yes
    Using Modem:        No
    Using LAN:             Yes
    Using Proxy:           No
    SSL 3.0 Support:     Enabled
    TLS 1.0 Support:     Enabled
    Firewall Information
    Windows Firewall is on.
    iTunes is enabled in Windows Firewall.
    Connection attempt to Apple web site was successful.
    Connection attempt to browsing iTunes Store was successful.
    Connection attempt to purchasing from iTunes Store was successful.
    Connection attempt to iPhone activation server was unsuccessful.
    The network connection timed out.
    Connection attempt to firmware update server was unsuccessful.
    The network connection timed out.
    Connection attempt to Gracenote server was successful.
    Last successful iTunes Store access was 2011-12-31 14:00:02.
    **** Device Connectivity Tests ****
    iPodService 10.5.2.11 is currently running.
    iTunesHelper 10.5.2.11 is currently running.
    Apple Mobile Device service 3.3.0.0 is currently running.
    Universal Serial Bus Controllers:
    Intel(R) 82801G (ICH7 Family) USB Universal Host Controller - 27C8.  Device is working properly.
    Intel(R) 82801G (ICH7 Family) USB Universal Host Controller - 27C9.  Device is working properly.
    Intel(R) 82801G (ICH7 Family) USB Universal Host Controller - 27CA.  Device is working properly.
    Intel(R) 82801G (ICH7 Family) USB Universal Host Controller - 27CB.  Device is working properly.
    Intel(R) 82801G (ICH7 Family) USB2 Enhanced Host Controller - 27CC.  Device is working properly.
    No FireWire (IEEE 1394) Host Controller found.
    Connected Device Information:
    rawkiss’s iPhone, iPhone 3G running firmware version 4.0
    Serial Number:       86931UEAY7H
    **** Device Sync Tests ****
    Sync tests completed successfully.

    I have found a fix after doing additional research through this forum. Tech Note #328730 addresses this problem and it works for Photoshop Album 3.2 even though it was written for release 1.0.
    Here is a link that will take you directly to the Tech Note:
    http://kb.adobe.com/selfservice/viewContent.do?externalId=328730
    When using this fix the Tech Note indicates:
    "Imported image data and tags are lost when you re-create the My Catalog.psa file, so you need to reimport images and reapply any tags"
    however it did retain the captions (at least it did for me).

  • Some email images do not show while using the icloud web app.  I can see the images on my IOS devices and in gmail but I only see a small gray box in the icloud web mail app.  Load HTML images is checked in preferences.

    Some email images do not show while using the icloud web app.  I can see the images on my IOS devices and in gmail but I only see a small gray box in the icloud web mail app.  Load HTML images is checked in preferences.  Is there a solution to this issue?

    I've seen the opposite issue.  My wife recieved an email with jpg attachments.  She couldn't see or print them on her iPhone 4S but they showed up fine in iCloud or in the mail app.  I had her forward the email to herself and then they showed up.  I assume there is an issue with how Apple is processing the attachments and resending causes them to get reformatted in a way that makes them easier to handle.
    So yeah.  Seems like some bugs.  Hope Apple fixes them soon.

  • Continued Problem (several weeks)with iArtwork not showing up

    I just don't get it, my artwork is still not showing up. The generic image is appearing for my podcast. My images do appear when the podcast plays, but the generic image is still appearing on my podcast page. I know the feed is correct. itunes continues to update when I send new images but my main artwork is still the itune generic- any suggestions. I've had my feed validated several times.
    getfitpod
    Dell   Windows 2000  

    See the forum announcement regarding problems with the iTunes podcast image.
    It's broke and Apple is working on fixing it.
    Look through some of the other threads regarding this problem for some helpful tips to ensure that your artwork will show up whenever Apple finally fixes it.
    Erik

  • I am trying to softproof an image using a CMYK .icc file. I sent an image from LR 5 to PS CC 2014, opened the Camera Raw FIlter, but the hyperlink to access workflow is not showing up in the CR dialogue box... Any ideas why this might be?

    I am trying to softproof an image using a CMYK .icc file. I sent an image from LR 5 to PS CC 2014, opened the Camera Raw FIlter, but the hyperlink to access workflow is not showing up in the CR dialogue box... Any ideas why this might be?

    I am trying to softproof an image using a CMYK .icc file. I sent an image from LR 5 to PS CC 2014, opened the Camera Raw FIlter, but the hyperlink to access workflow is not showing up in the CR dialogue box... Any ideas why this might be?

  • Added albums to iTunes, but they do not show up in the Music Library view.

    I imported some albums and the albums do not show up in the Music Library view, however I created a playlist containing all songs added today and they show right up. Is there a fix for this?

    They don't show up at all or they don't show up where you expect them to?
    The iTunes Library is divided into a number of sources, Music, Podcasts, Books etc. Each file added ends up in just one of these sources depending on its *Media Kind* plus any playlists for which it has matching criteria.
    Settings such as *Part of a Compilation, Sort Artist* or *Sort Album Artist* can make albums appear in an unexpected location within Music.
    See http://samsoft.org.uk/iTunes/grouping.asp for more on organising things in iTunes.
    tt2

  • When i attach my iphone 4 with computer it shows one of the USB devices attached to this computer has malfunctioned and windows does not recognize it,now what can i do ..plz help me

    when i attach my iphone 4 with computer it shows one of the USB devices attached to this computer has malfunctioned and windows does not recognize it,now what can i do ..plz help me

    I would first try unplugging All the USB devices plugged into your computer, and then plug back in just the iPhone and see if that is recognized.  Also, do you have the latest version of iTunes for Windows installed on your PC, as you need to?
    Hope this helps

  • Does anybody know why my ipod touch 3rd generations screen does not show anything? The screen is all black, when I try to synchronise my ipod to my library it comes up with a message saying "iTunes could not back up the ipod because a session could not be

    Does anybody know why my ipod touch 3rd generations screen does not show anything? The screen is all black constantly. When I try to synchronise my ipod with my iTunes library it comes up with a message saying " iTunes could not back up the ipod because a session could not be started with the ipod. Please help and reply if you know an answer!!!

    Try this previous discusssion:
    https://discussions.apple.com/message/12518406#12518406

  • I have downloaded a movie with subtitle to iMovie. When playing the video, the subtitle does not show up through the entire video. It happens to my Mac Air and Mac Pro.

    I have downloaded a video with subtitle. When playing the edited video, the subtitle does not show up in the entire video. The subtitle comes and goes in the video.I have tried with my Mac Pro and Mac Air, with the same result. I have downloaded movie with subtitle before and never had this problem. Please advise.

    I'm not very knowledgable on this but subtitles are sometimes on a separate track from the main movie.  Try opening the downloaded video in Quicktime Player and saving it - you may be asked if you want to "flatten movie".  Choose to do this.  The resulting movie will probably now work OK.  Others may be able to supply more comprehensive instructions.
    Geoff.

Maybe you are looking for

  • Error 500 AND 'No principal found for UID:' problems

    Hi, We are having problems familiar to what I read on this forum. First, the log-file mentions lots of times: 'No principal found for UID:blabla', with some lines following it. Second, we get error 500 when setting the delegates or even looking at it

  • How to download, unzip, and install software.

    Brand new to iMac. Downloaded Alice. Found it in downloads. Unzipped it. Now can't figure out how to install it/run it to save my freakin life. Help. Please & thank you.

  • Samba version not supported

    I have a Buffalo NAS and used to be able to mount the drive and browse natively within a previous version OS X (not sure after what upgrade it broke) natively without using a 3rd party application. I run 10.8.3 on all of the machines now and when att

  • SSL authentication Connectivity using Oracle JDK1.3

    Please let me know whether Oracle JDK1.3 will support the SSL authentication Connectivity. If not what is the workaround to make the SSL authentication connectivity work in oracle JDK 1.3 since this urgent,Please let us know this information at the e

  • After Effects hangs on "initializing Media Core"

    I might be off subject here, but my AE CS6 would not complete the start up and simply hang at "INITIALIZING MEDIA CORE". After finding some info about that, but for CS5, apparently a Quick Time codec problem, I got rid of PERIAN, and all is well now,