-
Oct 28th, 2009, 04:29 PM
#1
Thread Starter
Frenzied Member
Add underline to Excel file created in vb.net?
Hi Everyone,
How do you draw a solid underline from one cell to another? I tried the last line below to do this but it only underlines each word. Is there a way to connect the line?
Thanks!
Code:
xlWSheet.Range("A" & i.ToString).Value = "Local"
xlWSheet.Range("B" & i.ToString).Value = "Name"
xlWSheet.Range("C" & i.ToString).Value = "Reg Hours"
xlWSheet.Range("D" & i.ToString).Value = "OT Hours"
xlWSheet.Range("E" & i.ToString).Value = "DT Hours"
xlWSheet.Range("F" & i.ToString).Value = "Total Hours"
xlWSheet.Range("G" & i.ToString).Value = "Gross Wages"
xlWSheet.Range("A" & i.ToString & ":G" & i.ToString).Font.Underline = True
-
Oct 28th, 2009, 04:31 PM
#2
Re: Add underline to Excel file created in vb.net?
Do you not want to be setting the border style of the cell rather than an attribute of the font?
-
Oct 28th, 2009, 04:33 PM
#3
Thread Starter
Frenzied Member
Re: Add underline to Excel file created in vb.net?
Actually I just saw that about the border style. So I need to draw a solid black line across the cells for the bottom to act as an underline all the way across. Do you know the code to do this?
Thanks!
Warren
-
Oct 28th, 2009, 04:52 PM
#4
Re: Add underline to Excel file created in vb.net?
Try this...
vb Code:
xlWSheet.Range("A" & i.ToString).Value = "Local" xlWSheet.Range("B" & i.ToString).Value = "Name" xlWSheet.Range("C" & i.ToString).Value = "Reg Hours" xlWSheet.Range("D" & i.ToString).Value = "OT Hours" xlWSheet.Range("E" & i.ToString).Value = "DT Hours" xlWSheet.Range("F" & i.ToString).Value = "Total Hours" xlWSheet.Range("G" & i.ToString).Value = "Gross Wages" With xlWSheet.Range("A" & i.ToString & ":G" & i.ToString).Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread "Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|