Forums
New posts
Search forums
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
C# Community
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
VB.NET
Windows Forms
Interop Word
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="paulthepaddy, post: 134939, member: 33605"] hi all this is my code and under the code is my problem, sorry if i seem short, just day turning into a bad one lol [CODE]Dim oWord As Word.Application Dim oDoc As Word.Document If System.IO.File.Exists(Application.StartupPath & "\Templates\invoice.dotx") Then oWord = CreateObject("Word.Application") oWord.Visible = True oDoc = oWord.Documents.Add(Application.StartupPath & "\Templates\invoice.dotx") Dim rowsbefore As Integer = (oDoc.Tables(1).Rows.Count / 2) + 1 oDoc.Bookmarks.Item("CustomerName").Range.Text = customer_Name oDoc.Bookmarks.Item("AddressLine1").Range.Text = Address_Line1 oDoc.Bookmarks.Item("AddressLine2").Range.Text = Address_Line2 oDoc.Bookmarks.Item("Postcode").Range.Text = Postcode oDoc.Bookmarks.Item("PhoneNumber").Range.Text = phoneNumber oDoc.Bookmarks.Item("Invoice_Number").Range.Text = Invoice_Name oDoc.Bookmarks.Item("Date").Range.Text = Format(System.DateTime.Today, "dd / MM / yyyy") [COLOR=red] If Form_Invoice_Management.car1.finished = True Then oDoc.Tables(1).Cell(2, 1).Range.Text = Form_Invoice_Management.car1.Model oDoc.Tables(1).Cell(2, 2).Range.Text = Form_Invoice_Management.car1.Colour oDoc.Tables(1).Cell(2, 3).Range.Text = Form_Invoice_Management.car1.Reg [COLOR=seagreen]For i = 0 To Form_Invoice_Management.car1.damage.Count - 1 oDoc.Tables(1).Cell(2, 4).Range.Text &= Form_Invoice_Management.car1.damage(i) Next[/COLOR] oDoc.Tables(1).Cell(2, 5).Range.Text = Form_Invoice_Management.car1.Total Total_Discount += Form_Invoice_Management.car1.Discount Total_Subtotal += Form_Invoice_Management.car1.Total oDoc.Tables(1).Rows.Add(oDoc.Tables(1).Rows(rowsbefore)) End If[/COLOR] If Form_Invoice_Management.car2.finished = True Then oDoc.Tables(1).Cell(3, 1).Range.Text = Form_Invoice_Management.car2.Model oDoc.Tables(1).Cell(3, 2).Range.Text = Form_Invoice_Management.car2.Colour oDoc.Tables(1).Cell(3, 3).Range.Text = Form_Invoice_Management.car2.Reg [COLOR=deepskyblue] For i = 0 To Form_Invoice_Management.car2.damage.Count - 1 oDoc.Tables(1).Cell(3, 4).Range.Text &= Form_Invoice_Management.car2.damage(i) Next[/COLOR] oDoc.Tables(1).Cell(3, 5).Range.Text = Form_Invoice_Management.car2.Total Total_Discount += Form_Invoice_Management.car2.Discount Total_Subtotal += Form_Invoice_Management.car2.Total oDoc.Tables(1).Rows.Add(oDoc.Tables(1).Rows(rowsbefore)) End If[/CODE] For some reson the code in red is being executed but the data being processes in green is being mixed with the code in blue. instead of cell 2,4 being filled with data and the cell 3,4 being filled cell 3,4 is being filled with ALL data [/QUOTE]
Insert quotes…
Verification
Post reply
VB.NET
Windows Forms
Interop Word
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top
Bottom