http://blog.csdn.net/zhichao2001/article/details/7978934
transferred from: http://www.cnblogs.com/tiger8000/archive/2011/09/19/2181365.html hereby acknowledge
Guanven Download:
Http://mtsoftware.v053.gokao.net/download.html
Local Lodop6.034 version download:/files/tiger8000/lodop6.034.rar
Suppose your LODOP print control is placed in the LODOP directory under your project's root directory
The printtable.aspx file exists in the Printcenter directory in your project. In the HTML page of this file, add:
< script type = "text/javascript" language = "javascript src =". /lodop/lodopfuncs.js "></script >
< object id = "Lodop" classid = "clsid:2105c259-1e0c-4534-8141-a753534cb4ca" width = "0" height = "0" >
< Embed id = "Lodop_em" type = "Application/x-print-lodop" width = "0" height = "0" pluginspage = ". /lodop/install_lodop.exe "></Embed >
</Object >
which
< Embed id = "Lodop_em" type = "Application/x-print-lodop" width = "0" height = "0" pluginspage = ". /lodop/install_lodop.exe "></Embed >
is designed for the FireFox browser code, if you are the print control only on IE, the above words can not be used.
Just add it to the line:
< script type = "text/javascript" language = "javascript src =". /lodop/lodopfuncs.js "></script >
< object id = "Lodop" classid = "clsid:2105c259-1e0c-4534-8141-a753534cb4ca" width = "0" height = "0" >
</Object >
This calls the LODOP print control on this page.
To print a 100-line data report, to page printing, request, with A4 paper portrait printing, at the bottom of the page corner, display the current page number and total pages.
Normally, you set the print paper size, such as A4 or custom paper sizes, and then you define the size of the printout
Lodop. Add_print_table (750, 900, document.getElementById ("Printdiv"). InnerHTML);
From the top 110 pixels, 33 pixels to the left, 750 pixels wide, high 900 pixels in the outer area of the printed content. The print control will automatically according to the paper size and you print the district, high, calculate the number of printed pages, will automatically page, you need to do is to constantly adjust the print area margin, wide, High: 110, 33, 750, 900
Then, print out the current page/total number of pages yourself.
In the ASPX page, add:
< SCRIPT language = "javascript" type = "Text/javascript" >
var Lodop; Declared as a global variable
function Prn1_preview () {
Printmytable ();
Lodop. PREVIEW ();
};
function Prn1_print () {
Printmytable ();
Lodop. PRINT ();
};
function printmytable () {
Lodop = Getlodop (document.getElementById (' Lodop '), document.getElementById (' Lodop_em '));
Lodop. Print_init ("Yinyan company broadband Fee Details");
Lodop. Set_print_pagesize (1, 0, 0, "A4");
Lodop. Add_print_text (30, 280, 500, 50, "Yinyan company Broadband financial statement details")
Lodop. Set_print_stylea (1, "ItemType", 1);
Lodop. Set_print_stylea (1, "FontSize", 14);
Lodop. Set_print_stylea (1, "Bold", 1);
Lodop. Add_print_text (1050, 370, 200, 22, "page #/Total & page");
Lodop. Set_print_stylea (2, "ItemType", 2);
Lodop. Set_print_stylea (2, "Horient", 1);
Lodop. Add_print_text (90, 50, 100, 50, "Total:<%=numb%> Records")
Lodop. Set_print_stylea (3, "ItemType", 1);
Lodop. Add_print_text (90, 300, 350, 50, "time range:<%=begindt%> to <%=enddt%>")
Lodop. Set_print_stylea (4, "ItemType", 1);
Lodop. Add_print_table (750, 900, Document.documentElement.innerHTML);
Lodop. Add_print_table (750, 900, document.getElementById ("Printdiv"). InnerHTML);
};
</script >
Then, here is the Payroll report table to print
< div id = "Printdiv" >
< table width = "90%" align = "center" border = "1" cellpadding = "0" cellspacing = "0" bordercolor = "#0000 Bordercolorlight = "#000000" Bordercolordark = "#000000" id = "TB01" style = "Border-collapse:collapse" >
< Asp:repeater ID = "Repeater2" runat = "server" >
< HeaderTemplate >
< thead >
< tr bgcolor = "#F8F8FF" >
< th align = "center" height = "a" > Serial number </th >
< th align = "center" > name </th >
< th align = "center" > account </th >
< th align = "center" > Net fee </th >
< th align = "center" > Net fee rebate </th >
< th align = "center" > Deposit </th >
< th align = "center" > Deposit refund </th >
< th align = "center" > Installation fee </th >
< th align = "center" > Installation fee rebate </th >
< th align = "center" > Selling modem paragraph </th >
< th align = "center" > Modem rebate </th >
< th align = "center" > Transfer </th >
< th align = "center" > Payment date </th >
</TR >
</thead >
</HeaderTemplate >
< ItemTemplate >
< tbody >
< TR height = "the" style = "Cursor:hand" bgcolor = "#ffffff" onmouseover = "Javascript:this.style.backgroundCo Lor= ' #FFCC33 '; "onMouseOut