delphi - How to use OleVariant parameters to TWebBrowser Print dialog? -
i'm trying implement custom headers , footers when printing twebbrowser, per information in microsoft knowledge base question. knowledgebase article quite helpful , includes lengthy code example, however, code example in c++ not delphi, i've had attempt convert necessary data structure delphi code myself. i'm not terribly confident i've correctly converted part of code need.
here's important part of article, explains supposed go in paramater vain in code below:
when use olecmdid enumeration of olecmdid_print element execwb method, can specify extended printing information passing in safearray structure through variant argument pvain. safearray data type takes maximum of 5 items:
1) string (bstr) contains custom header. 2) string (bstr) contains custom footer. 3) ...
when run code i've written, removes original header , footer, not replace new header , footer strings, i'm wondering if code incorrect in way (or several ways), or if shouldn't expect work since i'm using ie 9 , not version in 4-6 range current @ time knowledgebase article written.
var vain, vaout: olevariant; begin vain := vararraycreate([0,1], varolestr); vain[0] := varastype('new header', varolestr); //header vain[1] := varastype('new footer', varolestr); //footer // show print-preview dialog webbrowser1.controlinterface.execwb(olecmdid_printpreview, olecmdexecopt_dontpromptuser, vain, vaout); end;
Comments
Post a Comment