Insert a picture in the Word document generated by ASP.NET

xiaoxiao2021-03-06  73

I use the following ways to save an HTML file into a word file and check with a picture.

Object Nothing = system.reflection.Missing.Value;

Object

SrcFileName = @ "d: /aa.html";

Object

DstFileName = @ "d: /li.doc";

Object objt = true;

Word.Application WordApp = new word.applicationclass ();

Word.Document WordDoc = NULL;

Object format = word.wdsaveformat.wdformatdocument;

Try

{

Worddoc = Wordapp.Documents.Open (Ref Format, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing;

//image

Word.shape oshape = worddoc.shapes.addpicture ("D: //dl_01.gif", ref Nothing, Ref Objt, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing;

Oshape.wrapformat.Type = word.wdwrapType.wdwrapsquare;

// Put the HTM file Save as a DOC file

WordDoc.saveas (Ref Dstfilename, Ref format, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing, Ref Nothing;

}

Finally

{

WordDoc.close (ref nothing, ref forking; refice);

Wordapp.quit (ref Nothing, ref nothing, ref nothing);

}

http://community.9cbs.net/expert/topic/3541/3541955.xml?temp=.7204096

转载请注明原文地址:https://www.9cbs.com/read-93048.html

New Post(0)