protected virtual void PopulateTime() { if (ParentOpCodeWrapper.Setup.Configuration.TimerRunEnabled) { MicroXTime time = new MicroXTime(); time.Set(ParentOpCodeWrapper.Setup.Configuration.TimerStart); OutReport.InsertBlock(time.GetBytes()); } }
private void populateBank1() { byte[] contactBytes = ContactsInBytes; if (contactBytes.Length > MAX_BANK0_SIZE) { byte[] bank1 = new byte[contactBytes.Length - MAX_BANK0_SIZE]; Array.Copy(contactBytes, MAX_BANK0_SIZE + 1, bank1, 0, bank1.Length); OutReport.InsertBlock(bank1); } }
private void populateInfo() { OutReport.InsertString(Comment); OutReport.Next = BREAK_BYTE; OutReport.InsertString(Author); OutReport.Next = BREAK_BYTE; OutReport.Next = NO_TIMEZONE; OutReport.Next = BREAK_BYTE; OutReport.Next = Convert.ToByte(ShowTemperatureInCelsius ? CELSIUS : FAHRENHEIT); OutReport.Next = BREAK_BYTE; OutReport.Next = Convert.ToByte(DisplayAlarmLevels ? '1' : '0'); }
//public void ExcelOut(GridView gv) //{ // if (gv.Rows.Count > 0) // { // grdvw_List.Caption = "<FONT style='WIDTH: 102.16%;font-size:22pt; LINE-HEIGHT: 150%; FONT-FAMILY: SimSun_GB2312; HEIGHT: 35px'><b>样 品 出 入 库 登 记 表</b></font>"; // Response.Clear(); // Response.ClearContent(); // Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.ToString("_yyyyMMdd_HHmmss") + ".doc"); // Response.ContentEncoding = System.Text.Encoding.UTF8; // Response.ContentType = "application/ms-word"; // StringWriter sw = new StringWriter(); // HtmlTextWriter htw = new HtmlTextWriter(sw); // gv.RenderControl(htw); // Response.Write("TXHJ/ZJ40" + "\n\r" + sw.ToString()); // Response.Flush(); // Response.End(); // grdvw_List.Caption = ""; // } // else // { // Response.Write("没有数据"); // } //} //public override void VerifyRenderingInServerForm(Control control) //{ // // base.VerifyRenderingInServerForm(control); //} protected void btn_print_Click(object sender, EventArgs e) { OutReport report = new OutReport(); try { string DocPath = Server.MapPath("../"); string TemplateFile = ""; TemplateFile = DocPath + "Sample\\template\\SampleInAndOut.doc"; report.CreateNewDocument(TemplateFile); int row = 4; string[] heads = new string[6]; int i = 0; foreach (GridViewRow gvr in grdvw_List.Rows) { report.AddRow(1, 1); string[] values = new string[6]; i = 0; foreach (TableCell tc in gvr.Cells) { if (tc.Text != " ") { values.SetValue(tc.Text, i++); } else { values.SetValue("", i++); } } // values.SetValue("", i++); report.InsertCell(1, row++, 6, values); //给模板中第一个表格的第二行的6列分别插入数据 } // report.AddRow(1,1); Microsoft.Office.Interop.Word.Table table = report.Document.Content.Tables[1]; report.MergeCell(table, row, 1, row, 6); // table. report.InsertCell(1, row, 1, "备注:"); table.Cell(row, 1).Range.Font.Size = Convert.ToSingle(10.5); table.Cell(row, 1).Range.Cells.VerticalAlignment = WdCellVerticalAlignment.wdCellAlignVerticalTop; table.Cell(row, 1).Range.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphLeft; // table.AutoFormat Random rd = new Random(); int oid = rd.Next(10000); //生成的具有模板样式的新文件 string FileName = DocPath + "Sample\\temp\\" + oid.ToString() + ".doc"; report.SaveDocument(FileName); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "window.open('temp/" + oid.ToString() + ".doc','theNewWindow',' left=0,top=0,width='+ (screen.availWidth - 10) +',height='+ (screen.availHeight-50) +',scrollbars,resizable=yes,toolbar=no')", true); } catch (Exception exp) { ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "click", "alert('" + exp.Message.ToString() + "');", true); } }
//public void ExcelOut(GridView gv) //{ // if (gv.Rows.Count > 0) // { // grdvw_List.Caption = "<FONT style='WIDTH: 102.16%;font-size:22pt; LINE-HEIGHT: 150%; FONT-FAMILY: SimSun_GB2312; HEIGHT: 35px'><b>样 品 登 记 表</b></font>"; // Response.Clear(); // Response.ClearContent(); // Response.AddHeader("Content-Disposition", "attachment; filename=" + DateTime.Now.ToString("_yyyyMMdd_HHmmss") + ".doc"); // Response.ContentEncoding = System.Text.Encoding.UTF8; // Response.ContentType = "application/ms-word"; // StringWriter sw = new StringWriter(); // HtmlTextWriter htw = new HtmlTextWriter(sw); // gv.RenderControl(htw); // Response.Write("TXHJ / ZJ39" + "\n\r" + sw.ToString()); // Response.Flush(); // Response.End(); // grdvw_List.Caption = ""; // } // else // { // Response.Write("没有数据"); // } //} //public override void VerifyRenderingInServerForm(Control control) //{ // // base.VerifyRenderingInServerForm(control); //} protected void btn_print_Click(object sender, EventArgs e) { OutReport report = new OutReport(); try { string DocPath = Server.MapPath("../"); string TemplateFile = ""; TemplateFile = DocPath + "Sample\\template\\SampleInOut.doc"; report.CreateNewDocument(TemplateFile); int row = 2; string[] heads = new string[12]; int i = 0; foreach (GridViewRow gvr in grdvw_List.Rows) { report.AddRow(1, 1); string[] values = new string[12]; i = 0; int j = 0; foreach (TableCell tc in gvr.Cells) { if (j > 0) { if (tc.Text != " ") { values.SetValue(tc.Text, i++); } else { values.SetValue("", i++); } } j++; } // values.SetValue("", i++); report.InsertCell(1, row++, 12, values); //给模板中第一个表格的第二行的5列分别插入数据 } Random rd = new Random(); int oid = rd.Next(10000); //生成的具有模板样式的新文件 string FileName = DocPath + "Sample\\temp\\" + oid.ToString() + ".doc"; report.SaveDocument(FileName); ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "", "window.open('temp/" + oid.ToString() + ".doc','theNewWindow',' left=0,top=0,width='+ (screen.availWidth - 10) +',height='+ (screen.availHeight-50) +',scrollbars,resizable=yes,toolbar=no')", true); } catch { report.killWinWordProcess(); } }
private void populateBank0() { byte[] contactBytes = ContactsInBytes; OutReport.InsertBlock(contactBytes); }
protected void PopulateData() { OutReport.InsertBlock(FWIterator.Current.Data); }
protected virtual void PopulateSN() { OutReport.InsertString(ParentOpCodeWrapper.Setup.Configuration.SerialNumber); }