2016-09-26 13 views
1

.Netのaspose.wordが新しくなりました。Aspose.word:ワードファイルにpdf添付ファイルを追加します。

私は添付ファイルとしてワード文書のテキストフィールドを置き換える必要のあるテンプレート文書を持っています。添付ファイルとしてExcel文書とPDF文書があります。

いつかワード文書に添付ファイルを追加できますか?

おかげで、 喜び

+0

? http://www.aspose.com/docs/display/wordsjava/How+to++Insert+a+Document+into+another+Document – zquanghoangz

答えて

0

あなたが適切なフィールドにデータをバインドしたら、PDFに変換します。次に、2つのPDFを一緒に参加させることができます。

using (var ms = new MemoryStream()) 
{ 
    // save Aspose doc to stream as pdf 
    doc.Save(ms, SaveFormat.Pdf); 
    ms.Position = 0; 

    // append doc 
    var pdf = new PdfDocument(ms); 
    pdf.Append(doc); 
    pdf.Save(fileName); 
} 
0

私は、あなたがテキストを検索し、画像およびOLEオブジェクトに置き換えることをAspose.Wordsではのfind and replace機能を使用してくださいお勧めします。 DocumentBuilder.InsertImageを使用してイメージをドキュメントに挿入し、DocumentBuilder.InsertOleObjectメソッドを使用して、ファイルの埋め込みまたはリンクされたOLEオブジェクトをドキュメントに挿入することができます。次の記事を参照してください。

Use DocumentBuilder to Insert Document Elements

私は、開発者エバンジェリストとしてのAsposeで動作します。

あなたはこれを試す

InsertOleObject


を使用することができます
0

:ここに何があなたを助けることができる

doc = new Document(); 
    DocumentBuilder builder = new DocumentBuilder(doc); 
    Stream memStream = File.OpenRead("addreess+file.xls"); 
    Shape oleObject = builder.InsertOleObject(memStream, "AcroExch.Document.7"", false, null); 
関連する問題