Excel vba emf pasted to worksheet print/pdf wrong size -
i'm taking enhanced meta file generated application (dplot jr) copying clipboard, , pasting excel(2007) worksheet. there use vba convert file pdf. code have that:
' copy graph eml file clip board ret = dplot_command(doc, "[copypicture()]") ' copy clip board contents new temp worksheet (under covers) 'hide application application.screenupdating = false 'create new temp worksheet set ws = activeworkbook.sheets.add(after:=sheets(1)) ws.name = "temp_graph_dpjr" ws.activate 'paste temp worksheet activesheet.paste 'save pdf excel activesheet.exportasfixedformat _ type:=xltypepdf, _ filename:=pdf_filename, _ openafterpublish:=false i discovered that, image gets created in pdf larger actual size of graphic. example, width of graphic should 2.65". size of graph in pdf 2.816, .166" or 1 pica, appears added.
while could, , may have to, decrease size of image .166" seems kind of hacky , i'd have image's original size come over.
i discovered if paste image chartsheet, size maintained, image becomes bitmap on teh chartsheet page.
when create pdf, have correct settings. have no margins, actual size, etc.
has else seen this? can help? need have image pdf.
thanks help!
russ
well, strange, , shouldn't make difference, does, far appear work.
in above workflow, after pasting emf worksheet, if select image copy new chartsheet, original size maintained, vector nature of graphic. here code:
ret = dplot_command(doc, "[copypicture()]") ' copy clip board contents new temp worksheet (under covers) 'hide application application.screenupdating = false 'create new temp worksheet set ws = activeworkbook.sheets.add(after:=sheets(1)) ws.name = "temp_graph_dpjr" ws.activate 'paste temp worksheet select/copy 1 activesheet.paste selection.copy 'create new temp chart set temp_chart = activeworkbook.charts.add 'temp_chart.name = "temp_chart" 'set linesytle of border none temp_chart.chartarea.border.linestyle = xlnone 'paste dplotjr graph chart sheet 'we had this maintained size of graph 'dumb ms excel worksheet temp_chart.paste 'paste temp worksheet 'activesheet.paste 'save pdf excel activesheet.exportasfixedformat _ type:=xltypepdf, _ filename:=pdf_filename, _ openafterpublish:=false it though excel determines paste app , pastes bitmap chartsheet, if determines itself, pastes vector image. maybe loophole might go away in future, seems work far.
fwiw!
Comments
Post a Comment