private void tspProcessTemplate_Click(object sender, EventArgs e) { try { VelocityEngine ve = new VelocityEngine(); ve.Init(); VelocityContext ct = new VelocityContext(); AbapCode code = new AbapCode(); ct.Put("test", this.sapTableField1.TableList); System.IO.StringWriter vltWriter = new System.IO.StringWriter(); ve.Evaluate(ct, vltWriter, null, this.textTemplate.Text); textResultCode.Text = vltWriter.GetStringBuilder().ToString(); } catch (Exception ee) { MessageBox.Show(ee.Message); } }
private void processTemplate() { if (rfctable.Fields.Count ==0 ) { MessageBox.Show("没有字段"); return; } try { VelocityEngine ve = new VelocityEngine(); ve.Init(); VelocityContext ct = new VelocityContext(); AbapCode code = new AbapCode(); ct.Put("rfctable", rfctable); System.IO.StringWriter vltWriter = new System.IO.StringWriter(); ve.Evaluate(ct, vltWriter, null, this.textBoxTemplate.Text); this.textBoxResult.Text = vltWriter.GetStringBuilder().ToString(); MessageBox.Show("处理成功"); } catch (Exception exception) { MessageBox.Show(exception.Message); //throw; } }
private void tspGenerateCode_Click(object sender, EventArgs e) { AbapCode code = new AbapCode(); code.Tables = this.sapTableField1.TableList; this.textResultCode.Text = code.Excute(); }