3
텍스트와 이미지를 PowerPoint에서 Word로 복사하려면 응용 프로그램이 필요합니다. 이 라이브러리를 사용합니다 : Microsoft.Office.Interop.PowerPoint 및 Microsoft.Office.Interop.Word. C# 이미지 형식 복사 PowerPoint to Word
는 텍스트들로 전송하기 쉬운,하지만 난 파워 포인트에 불과 이미지를 포함하는 형태를 발견 할 때, 그것은이 오류를 보여줍니다 " 일반 오류가 발생했습니다 GDI +", 코드의이 부분에서 :foreach (PowerPoint.Shape shape in slide.Shapes)
{
if (shape.HasTextFrame != MsoTriState.msoTrue){
shape.Copy();
Image img = (Image)Clipboard.GetData(DataFormats.Bitmap);
string filepath = Environment.SpecialFolder.Desktop + "\\img.jpg";
if (File.Exists(filepath))
{
File.Delete(filepath);
}
img.Save(filepath);
doc.Shapes.AddPicture(filepath, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
}
}
이 상황에서 PowerPoint에서 Word로 이미지가 포함 된 도형을 복사하려면 어떻게해야합니까? 도움이됩니다. 나는 약간의 코드 샘플을 선호한다.
감사합니다.
shape.Copy() 또는 Clipboard.GetData (..)가 실패합니까? –
Clipboard.GetData (..)에서 실패합니다 – Emanuel
코드는 Win7 상자 (.Net4 및 Office 2010)에서 제대로 작동합니다. 어떤 OS를 실행하고 어떤 버전의 .Net? –