Too Many Labels Being Printed 追蹤

0
Avatar
Legacy Poster

Intermittently we are getting extra labels printed. For example, the SQL in the label design file will return 6 rows but we'll actually get 500 labels printed. Of course, this doesn't happen all the time and we can't seem to make it happen. Has anyone else observed this behavior?

For what it's worth, here's the code:
[code] public static string PrintOwnerLabel(string UserID, string Printer, long AssetID, out Messages btMessages)
{
EngineWrapper eng = new EngineWrapper();

//Get path to BarTender format files
string formatFileName = GetBTFormatsPath() + @"\OwnerLabel.btw";

//Set the connection for the label format file
LabelFormat formatFile = new LabelFormat(formatFileName);

//Open the label format file
LabelFormatDocument btFormat = eng.BtEngine.Documents.Open(formatFile, out btMessages);
HttpContext.Current.Response.Write("|Opened the label format file|");

// Set the name of the printer if specified
if (Printer != "")
{ btFormat.PrintSetup.PrinterName = Printer; }

// Retrieve the QueryPrompts object.
QueryPrompts queryprompts = btFormat.DatabaseConnections.QueryPrompts;
queryprompts["AssetID"].Value = AssetID.ToString();

//Print the label
Result result = Seagull.BarTender.Print.Result.Failure;
HttpContext.Current.Response.Write("|Issuing Print command|");
result = btFormat.Print("Owner Label " + UserID, out btMessages);
HttpContext.Current.Response.Write("|Returned from Print command|");

btFormat.Close(SaveOptions.DoNotSaveChanges);
HttpContext.Current.Response.Write("|Closed the label format file|");

eng.BtEngine.Stop();
eng.BtEngine.Dispose();

return result.ToString();
}
[/code]

4 意見

0
Avatar
Michael Toupin (mtoupin
評論操作 永久連結

[quote name='Doug Hebert' timestamp='1358803069' post='4141']
Intermittently we are getting extra labels printed. For example, the SQL in the label design file will return 6 rows but we'll actually get 500 labels printed. Of course, this doesn't happen all the time and we can't seem to make it happen. Has anyone else observed this behavior?

For what it's worth, here's the code:
[code] public static string PrintOwnerLabel(string UserID, string Printer, long AssetID, out Messages btMessages)
{
EngineWrapper eng = new EngineWrapper();

//Get path to BarTender format files
string formatFileName = GetBTFormatsPath() + @"\OwnerLabel.btw";

//Set the connection for the label format file
LabelFormat formatFile = new LabelFormat(formatFileName);

//Open the label format file
LabelFormatDocument btFormat = eng.BtEngine.Documents.Open(formatFile, out btMessages);
HttpContext.Current.Response.Write("|Opened the label format file|");

// Set the name of the printer if specified
if (Printer != "")
{ btFormat.PrintSetup.PrinterName = Printer; }

// Retrieve the QueryPrompts object.
QueryPrompts queryprompts = btFormat.DatabaseConnections.QueryPrompts;
queryprompts["AssetID"].Value = AssetID.ToString();

//Print the label
Result result = Seagull.BarTender.Print.Result.Failure;
HttpContext.Current.Response.Write("|Issuing Print command|");
result = btFormat.Print("Owner Label " + UserID, out btMessages);
HttpContext.Current.Response.Write("|Returned from Print command|");

btFormat.Close(SaveOptions.DoNotSaveChanges);
HttpContext.Current.Response.Write("|Closed the label format file|");

eng.BtEngine.Stop();
eng.BtEngine.Dispose();

return result.ToString();
}
[/code]
[/quote]

Hi Doug,

It doesn't look like there's anything in your code that is specifying the number of labels. What does the label format have for number of identical copies? Is it set to a data source or just the static number?
0
Avatar
Legacy Poster
評論操作 永久連結

We have it set to a data source and that sql when we "browse" returns the correct # of rows.

But I don't know where this "number of identical copies" setting is that you're referring to is. Where is that setting?
0
Avatar
Michael Toupin (mtoupin
評論操作 永久連結

[quote name='Doug Hebert' timestamp='1358861276' post='4151']
We have it set to a data source and that sql when we "browse" returns the correct # of rows.

But I don't know where this "number of identical copies" setting is that you're referring to is. Where is that setting?
[/quote]

Depending on the version of BarTender you're using it will be in the print dialog, either listed as 'number of identical copies' or just 'copies'.
0
Avatar
Legacy Poster
評論操作 永久連結

That is set to 1.

登入寫評論。