michelleHEC
Programmer
I have created an excel sheet using vb.net and I am able to set the row size and column size etc but I need to be able to set a page break when a variable changes.
Any ideas??
here is a snipit of the code I am using...
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
xlSheet.Cells.ColumnWidth = 13
xlSheet.Cells.RowHeight = 15
xlSheet.Cells.Font.Size = 12
xlSheet.PageSetup.PrintGridlines = True
xlSheet.Cells(1, 1) = "Truck No"
xlSheet.Cells(1, 2) = "SO Number"
Dim sqlC As String = "Select * from DelTracking order by TruckNo, SONumber"
Dim cmC As New SqlClient.SqlCommand(sqlC, SqlConnection3)
SqlConnection3.Open()
Dim rdrC As SqlClient.SqlDataReader
rdrC = cmC.ExecuteReader
Do While rdrC.Read
SO = rdrC.Item("SONumber")
truck = rdrC.Item("TruckNo")
If truckchange <> truck Then
'***this is where i want to create a page break
rowcount = 2
thanks in advance!
Michelle
Any ideas??
here is a snipit of the code I am using...
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
xlApp = CType(CreateObject("Excel.Application"), Excel.Application)
xlBook = CType(xlApp.Workbooks.Add, Excel.Workbook)
xlSheet = CType(xlBook.Worksheets(1), Excel.Worksheet)
xlSheet.Cells.ColumnWidth = 13
xlSheet.Cells.RowHeight = 15
xlSheet.Cells.Font.Size = 12
xlSheet.PageSetup.PrintGridlines = True
xlSheet.Cells(1, 1) = "Truck No"
xlSheet.Cells(1, 2) = "SO Number"
Dim sqlC As String = "Select * from DelTracking order by TruckNo, SONumber"
Dim cmC As New SqlClient.SqlCommand(sqlC, SqlConnection3)
SqlConnection3.Open()
Dim rdrC As SqlClient.SqlDataReader
rdrC = cmC.ExecuteReader
Do While rdrC.Read
SO = rdrC.Item("SONumber")
truck = rdrC.Item("TruckNo")
If truckchange <> truck Then
'***this is where i want to create a page break
rowcount = 2
thanks in advance!
Michelle