?
Solved

How can I create Avery style mailing labels from my ASP.net website with sql server database backend

Posted on 2014-08-13
11
Medium Priority
?
965 Views
Last Modified: 2014-10-24
I am trying to figure out what is the best way to create Avery type labels from my .aspx pages.  I've seen posts about .rdlc reports, pdf dll's, data dumps and Word mail merge.  Has anyone had any success?

I have a SQL Server database back end and ASP.Net/VB front end.
0
Comment
Question by:john
  • 6
  • 3
9 Comments
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40260465
There's no good way to do that. The application that will be printing your labels is web browser, and web browsers don't have a lot of flexibility in precise printing. The best is to create desktop application using the same Visual Studio. Incidentally, everything you mentioned as what you heard, does pertain to desktop applications, with the exception of the rdlc report.

If desktop application is an option, we can tell further details, how to achieve what you want.

If you still want to pursue asp.net route, start with experimenting with your web browser. Create a simple static html webpage, and print it from your browser on your printer with the labels, and to achieve the result you want.
0
 

Author Comment

by:john
ID: 40261590
I've already determined the web browser is not the way to go.  Although, someone had mentioned there were .rdlc templates out there for Avery labels.  But I could not find them to try and I'm not a big .rdlc fan because of cross browser formatting/printing issues.

My sites are not public sites. They are business web applications.  So I can control what the user is forced to use - and I can give training if necessary.  I would like to avoid training though.  I want it to be as easy to use as possible.

Any suggestions would be helpful.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40261674
So if you already determined that web browser is not the way to go, then how do you plan to "create Avery style mailing labels from my ASP.net website" , if not in web browser?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:john
ID: 40261905
I was thinking I could have premade Word templates with data connections in them in a folder on the website. The user would be able to view these templates as links on their website.  

I was going to allow them to build their data source by entering their search parameters and then click on the template and view/print it.  The word label template would fill with data from the sql datasource.

I am just not sure if I can create Word label templates with an Sql connection and datasource that will refresh with the current datasource each time it is clicked.  That is the option I am pursuing right now.

If that's not possible I was thinking of doing a vb program that they could download from the website.  

I've also read about add on products that I could install on my webserver to which I could create pdf files formatted as labels from my website.

So I am looking for solutions to my problem however they may need to happen.
0
 
LVL 40

Assisted Solution

by:Vadim Rapp
Vadim Rapp earned 2000 total points
ID: 40261985
> I am just not sure if I can create Word label templates with an Sql connection and datasource that will refresh with the current datasource each time it is clicked.  That is the option I am pursuing right now.

The answer to this is in the macro AutoNew.

One problem you may face however is if the label printer is not the default printer for the computer.

In my own applications (desktop ones, however), I addressed the problem of label printing by having an RTF file as template, with placeholders for the variable information. The application reads the template, replaces placeholders by their values, saves modified rtf file in %temp%, then calls write.exe /pt <file> <printer>.  This solution is fully standalone, and does not even require Office.
0
 

Author Comment

by:john
ID: 40262112
That works ok for form letters where you are only replacing single place holders.   Not sure how I would create an .rtf template file that I could use for Avery 5160 labels for example that would create a file with varying amounts of names and addresses.
0
 
LVL 40

Accepted Solution

by:
Vadim Rapp earned 2000 total points
ID: 40262287
Right, if there are multiple labels, then probably Word mail merge is the way.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40262325
...with vba code like this:

with MailMerge
.OpenDataSource Name:="C:\myfile.ODC", sqlstatement:="select firstname from employees", connection:="Provider=SQLOLEDB;Integrated Security=SSPI;Initial Catalog=mydb;Data Source=myserver"
.Destination=wdSendToPrinter
.Execute
end with

Open in new window

myfile.ODC can be an empty file, but must exist.
0
 
LVL 40

Expert Comment

by:Vadim Rapp
ID: 40262939
...although, once I thought little more about it, it's still possible to do with the RTF technique. For example, introduce hidden placeholder "next record", and when parsing the text and encountering it, loop to the next record in the code.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
One of the most important things in an application is the query performance. This article intends to give you good tips to improve the performance of your queries.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how the fundamental information of how to create a table.
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question