Re: Vertical Alignment Probleme
13.09.2002 11:15:54
Moritz
Jo, er sagt 'Falsch'!
Ich generiere die Tabelle per VBS, hier mal der komplette Code:Set excel = CreateObject("Excel.Application")
Set xlBook = Excel.Workbooks.Add
Set ex = xlBook.Sheets(1)
Set ps = ex.PageSetup
on error resume next
'############Headers on each page.
ps.LeftHeader = "&""Arial Black,Fett""&21VOITH PAPER"
ps.RightFooter = _
"&""Arial Black,Fett""&21VOITH" & Chr(10) & "&""Arial,Standard""&6GROUP OF COMPANIES"
ps.CenterFooter = "Page &P"
ps.Orientation = 2 '2 = xlLandscape => page orientated horizontaly
'######## Settings ############
excel.Columns("A:J").Select
Excel.Selection.HorizontalAlignment = -4131 'Alignment on the left of each cell
ex.Columns("A:J").WrapText = True
ex.Columns("E:J").ColumnWidth = 12
ex.Columns("A:A").ColumnWidth = 18
ex.Columns("B:B").ColumnWidth = 6
ex.Columns("C:C").ColumnWidth = 6
ex.Columns("D:D").ColumnWidth = 14
Excel.ActiveSheet.Cells..VerticalAlignment = xlTop <------- Hier das VerticalAlignment
ex.Cells.Font.Size = 6
'#########The thick lines (L2) at the top of the first page and the title ##########
ex.Rows("1:1").RowHeight = 2
ex.Range("1:1").Interior.ColorIndex = 5
ex.Rows.Range("A2") = "Verfahrensstufe"
ex.Rows.Range("B2") = "Bauart"
ex.Rows.Range("C2") = "Status"
ex.Rows.Range("D2") = "Name"
ex.Rows.Range("E2") = "Leitung COP (PG)"
ex.Rows.Range("F2") = "Konstruktion"
ex.Rows.Range("G2") = "Technologie"
ex.Rows.Range("H2") = "Projektierung"
ex.Rows.Range("I2") = "Abwicklung"
ex.Rows.Range("J2") = "Service"
ex.Rows("2:2").Font.Bold = True
ex.Rows("3:3").RowHeight = 2
ex.Range("3:3").Interior.ColorIndex = 5
Gras = False
Offset = 4
Hautini = 20.75 'Height of the page after the title <=> Hautini = 2*4 + 12.75
Haut = Hautini
HautLimit = 420 'Limit height of the page in order to call the page break
'############## Begin of the reading part ###########
For Ligne = 3 to tabcount
Ans1 = StrComp("L2", Tab(0, Ligne), 0)
If Ans1 = 0 Then 'Case it is a L1
If Haut > HautLimit then
ex.Rows(Offset).RowHeight = 0.5
ex.Range("A" & Offset & ":J" & Offset).Interior.ColorIndex = 5
Offset = Offset + 1
With excel.ActiveSheet
.HPAgeBreaks.Add .Range("A" & Offset )
End With
'Title of the subject on each pages
ex.Rows("1:3").Copy
ex.Rows(Offset).Select
ex.Paste
Haut = Hautini
Offset = Offset + 2
Else ' <=> If Haut < HautLimit
ex.Rows(Offset).RowHeight = 0.75
ex.Range("A" & Offset & ":J" & Offset).Interior.ColorIndex = 5
End If
Gras = False
Else '## <=> If Ans1 <> 0. Er schreibt hier den text ##
c = 0 ' c is the columns of the array (from 0 to 4)
For Asci = 65 to 74 ' <=> from A to J, the columns of the excel sheet
Col = Chr(Asci)
ex.Range(Col & Offset) = Tab(c, Ligne)
ex.Range(Col & Offset).Font.Bold = Gras
c = c + 1
Next
Gras = False
End If
RowH = ex.Rows(Offset).RowHeight
Haut = Haut +RowH
Offset = Offset + 1
Next
ex.Range("A1").Select
ex.SaveAs("C:\Temp\mdv\text" & zahl & ".xls")
err.clear
excel.Quit
Set excel = Nothing
Set xlBook = Nothing
Set ex = Nothing
Set ps = Nothing