How to convert visual foxpro 6 report to word -
i have used following code show report.
select mem_no,com_name,owner,owner_cate,iif(empty(photo),"c:\edrs\memphoto\void.jpg",iif(file(photo),photo,"c:\edrs\memphoto\void.jpg")) photo own1 curs own repo form c:\edrs\reports\rptsearch.frx print preview nocons
here rptsearch.frx contains image. following code export data excel except image.
copy "c:\documents , settings\administrator\desktop\a.xls" type xls
in case of image shows path name. need know how can convert report in word can have images in word report.
it looks creating simple list pictures. 1 of easiest ways use automation. ie:
select mem_no,com_name,owner,owner_cate,; iif(empty(photo) or !file(photo),"c:\edrs\memphoto\void.jpg",photo) photo ; own1 ; curs crsdata ; nofilter #define wdword9tablebehavior 1 #define wdautofitwindow 2 #define wdstory 6 #define wdcollapseend 0 #define wdcellalignverticalcenter 1 #define cr chr(13) local array lacaptions[5] lacaptions[1] = 'mem no' lacaptions[2] = 'com name' lacaptions[3] = 'owner' lacaptions[4] = 'owner cate' lacaptions[5] = 'photo' local nrows, ncols, ix nrows = reccount('crsdata')+1 ncols = fcount('crsdata')+1 oword = createobject('word.application') m.oword odocument = .documents.add m.odocument.tables.add( m.oword.selection.range, m.nrows, m.ncols) .borders.insidelinestyle = .f. .borders.outsidelinestyle = .f. ix=1 alen(lacaptions) **** add captions ***** .cell(1,m.ix).range.insertafter( lacaptions[m.ix] ) endfor select crsdata scan ix=1 fcount()-1 && last 1 photo path **** add values different cells ***** .cell(recno()+1,m.ix).range.insertafter( eval(field(m.ix)) ) endfor lcphoto = crsdata.photo if file(m.lcphoto) && add photo if odocument.inlineshapes.addpicture( m.lcphoto, .t., .t.,; .cell(recno()+1,fcount()).range) endif .rows(recno()+1).cells.verticalalignment = wdcellalignverticalcenter endscan endwith .visible = .t. endwith
however, sending data word way suffer performance if have many rows. can use small data employee table or so. larger data, instead of using automation, create html document , word open html document.
Comments
Post a Comment