放截图,我还是一个c#新手,如果觉得我的代码乱糟糟的见谅一下
下面是代码
private static BarTender.Application btApp;
private static BarTender.Format btFormat;
public void OnPost()
{
//前台接收的值
var allStr = Number.PadLeft(4, '0') + Year.PadLeft(2, '0') + Batch.PadLeft(2, '0') + Month.PadLeft(2, '0') + ProductNumber.PadLeft(2, '0');
try
{
btApp = new BarTender.Application();
//程序运行到这里就不往下运行 然后就报System.ExecutionEngineException:“Exception_WasThrown”
btFormat = btApp.Formats.Open("C:\\WWW\\test.btw", false, "");
//设置同序列的打印份数
btFormat.PrintSetup.IdenticalCopiesOfLabel = 1;
//设置需要打印的序列数
btFormat.PrintSetup.NumberSerializedLabels = 3;
//向bartender模板传递变量
btFormat.SetNamedSubStringValue("test", allStr);
//第二个false设置打印时是否跳出打印属性
btFormat.PrintOut(true, false);
//退出时是否保存标签
}
catch (Exception ex)
{
Console.WriteLine(string.Format("异常信息:{0}", ex.Message));
}
finally
{
}