Dim fileName As String = "tabel_" & Date.Now.ToShortDateString()
Response.Clear()
Response.Buffer = True
Response.AddHeader("content-disposition", String.Format("attachment; filename={0}", fileName & ".doc"))
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Response.Charset = ""
Response.ContentEncoding = Encoding.UTF8
Response.ContentType = "application/vnd.ms-word "
Response.Write("<html>")
Response.Write("<head>")
Response.Write("<META HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=UTF-8'>")
Response.Write("<style>")
Response.Write("@page Section1 {size:595.45pt 841.7pt; margin:1.0in 1.25in 1.0in 1.25in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}")
Response.Write("div.Section1 {page:Section1;}")
Response.Write("@page Section2 {text align:Center;size:841.7pt 595.45pt;mso-page-orientation:landscape;margin:1.25in 1.0in 1.25in 1.0in;mso-header-margin:.5in;mso-footer-margin:.5in;mso-paper-source:0;}")
Response.Write("div.Section2 {page:Section2;}")
' Response.Output.Write("<html><head><title>عرض ملخص</title></head><body dir='rtl'><Div align='center' dir='rtl' style='width: 100%' >" & sw.ToString() & "</div></body></html>")
gvEmployeeEvaluation.RowStyle.HorizontalAlign = HorizontalAlign.Center
Response.Write("</style>")
Response.Write("</head>")
Response.Write("<body dir='rtl'>")
Response.Write("<div class=Section2>")
Response.Output.Write("<html><head><title>عرض ملخص</title></head><body dir='rtl'><Div align='center' dir='rtl' style='width: 100%' >" & " تقرير تقييم الموظفين / " & " لعام : " & ddlYears.SelectedValue & " وشهر " & ddlMonths.SelectedItem.Text & "</div></body></html>")
Response.Output.Write("<html><head><title>عرض ملخص</title></head><body dir='rtl'><Div align='center' dir='rtl' style='width: 100%' >" & " في قسم: " & ddlDepartments.SelectedItem.Text & "</div></body></html>")
Response.Output.Write("<html><head><title>عرض ملخص</title></head><body dir='rtl'><Div align='center' dir='rtl' style='width: 100%' >" & " تم التقييم بواسطة : " & Session("Full_Name").ToString & "</div></body></html>")
'gvEmployeeEvaluation.AllowPaging = False
'gvEmployeeEvaluation.DataBind()
gvEmployeeEvaluation.Columns.Item(5).Visible = True
gvEmployeeEvaluation.Columns.Item(6).Visible = True
gvEmployeeEvaluation.Columns.Item(7).Visible = True
gvEmployeeEvaluation.Columns.Item(8).Visible = True
gvEmployeeEvaluation.Columns.Item(9).Visible = True
gvEmployeeEvaluation.Columns.Item(10).Visible = True
gvEmployeeEvaluation.Columns.Item(11).Visible = True
gvEmployeeEvaluation.Columns.Item(2).Visible = False
gvEmployeeEvaluation.Columns.Item(13).Visible = False
gvEmployeeEvaluation.Columns.Item(12).Visible = False
gvEmployeeEvaluation.Columns.Item(14).Visible = False
gvEmployeeEvaluation.Columns.Item(15).Visible = False
gvEmployeeEvaluation.UseAccessibleHeader = True
gvEmployeeEvaluation.HeaderRow.TableSection = TableRowSection.TableHeader
gvEmployeeEvaluation.FooterRow.TableSection = TableRowSection.TableFooter
Dim sw As New IO.StringWriter()
Dim hw As New HtmlTextWriter(sw)
gvEmployeeEvaluation.RenderControl(hw)
Dim gridHTML As String = sw.ToString().Replace("""", "'").Replace(System.Environment.NewLine, "")
Response.Write(sw.ToString())
Response.Write("</div>")
Response.Write("</body>")
Response.Write("</html>")
Response.Flush()
Response.End()
السؤوال
اذاكانت الجريد فيو عدد السجلات فيها 200
كيف اطبع في الصفحة الاول 10 سجلات
والصفحة الثانية 10 سجلات مع تكرار الهيدر والفوتر
ومع تكرار الاسطر الثلاثة
الموجدودة في div