1
我正在操作使用OpenXML SDK的Power Point幻燈片。幻燈片上有一個圖像。我想要做的是,如果在服務器上找到特定圖像,請使用服務器上找到的幻燈片圖像替換幻燈片圖像,否則完全刪除圖像。OpenXML SDK從PowerPoint中刪除圖像幻燈片
我有更換工作正常,但如果我嘗試刪除圖片我仍然得到了「此圖片無法顯示」,在它的圖像控制。
下面是我在做什麼要刪除的圖像,請注意slidePart是滑我操作:
'get the first image on the slide
Dim blip As Drawing.Blip = slidePart.Slide.Descendants(Of Drawing.Blip)().First()
blip.Remove()
slidePart.Slide.Save()
誰能告訴我什麼,我做錯了什麼?任何意見將不勝感激,非常感謝。
嗨,感謝您的迴應。滑動僅上有一個圖像,我嘗試以下:'昏暗imageToRemove作爲DocumentFormat.OpenXml.Presentation.Picture = slidePart.Slide.Descendants(OF DocumentFormat.OpenXml.Presentation.Picture)()的SingleOrDefault()',但我。我無法獲得任何回報。如果我只有一個圖像,我不應該通過圖像名稱進行搜索? – TheMethod 2012-08-09 15:26:09
'Picture'元素位於'slidePart.Slide.CommonSlideData.ShapeTree'的子元素中,因此請嘗試在其中搜索元素。如果只有一張圖片,則不必通過文件名進行搜索。 – amurra 2012-08-09 15:53:12
感謝您的回覆。我想'DocumentFormat.OpenXml.Presentation.Picture = slidePart.Slide.CommonSlideData.ShapeTree.Descendants(中DocumentFormat.OpenXml.Presentation.Picture)()的SingleOrDefault()',但我仍然得到什麼回來。 – TheMethod 2012-08-09 16:15:53