Hello to all. I am using VS 08 together with MySQL for the database.
I am trying to print labels using an application I am developing. I found this template in word in which represents the label paper I have. I have attached the template. The template consists of a table with 13 rows and 5 columns. In every cell in the table I am adding bookmarks so I can send data from vb. I have used bookmarks before with no problems. In this case the data do not go in the correct place. I am guessing because they are within a cell in the table. So I will have to choose the cell before sending the data. I do not know how to do that. What I have tried is this:
You can see I attempted to select the cell I want to print in but with no results. The rest of the bookmarks just send data with no cell selected. Also in this case the text is printed elsewhere. Anybody with some help on how to select the cell I want to send data? As shown in the code one of the bookmarks is a barcode. I am senting the number sequence which I want word to use the barcode font and convert to a barcode. This does not work. I place the bookmark on the the highlighed barcode font but nothing. I have tried to use Crystal Reports to print my labels but I am having problems just connecting to my database as I am using Mysql. Anyone has any links to assist me in printing this labels. Any solution accepted.m Whether that is a finished component I can download (even one that needs paying it), suggestions, links, tutorials.
Thanks for all your efforts and replies.
I am trying to print labels using an application I am developing. I found this template in word in which represents the label paper I have. I have attached the template. The template consists of a table with 13 rows and 5 columns. In every cell in the table I am adding bookmarks so I can send data from vb. I have used bookmarks before with no problems. In this case the data do not go in the correct place. I am guessing because they are within a cell in the table. So I will have to choose the cell before sending the data. I do not know how to do that. What I have tried is this:
VB.NET:
Dim oWord As Word.Application
Dim oDoc As Word.Document
'Start Word and Open document template
oWord = CType(CreateObject("Word.Application"), Word.Application)
oWord.Visible = False ' tells whether to show the Office Word program or not
oDoc = oWord.Documents.Add("C:\Users\KoRnHoLiOs\Documents\Visual Studio 2008\Projects\Shop\pok.doc")
oDoc.Tables(1).Cell(2, 1).Range.Bookmarks.Add("name").Range.Text = reader("name").ToString
oDoc.Bookmarks.Add("price").Range.Text = reader("sell").ToString
oDoc.Bookmarks.Add("colour").Range.Text = reader("colour").ToString
oDoc.Bookmarks.Add("barcode").Range.Text = reader("barcode").ToString
oWord.PrintOut()
oWord.Documents.Close(Word.WdSaveOptions.wdDoNotSaveChanges)
oWord.Quit()
oWord = Nothing
reader.Close()
conn.Dispose()
You can see I attempted to select the cell I want to print in but with no results. The rest of the bookmarks just send data with no cell selected. Also in this case the text is printed elsewhere. Anybody with some help on how to select the cell I want to send data? As shown in the code one of the bookmarks is a barcode. I am senting the number sequence which I want word to use the barcode font and convert to a barcode. This does not work. I place the bookmark on the the highlighed barcode font but nothing. I have tried to use Crystal Reports to print my labels but I am having problems just connecting to my database as I am using Mysql. Anyone has any links to assist me in printing this labels. Any solution accepted.m Whether that is a finished component I can download (even one that needs paying it), suggestions, links, tutorials.
Thanks for all your efforts and replies.