[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Round Corners of a table

Posted on 2006-12-01
7
Medium Priority
?
3,242 Views
Last Modified: 2012-05-05
Hi experts,

I want to format a table with rounded corners - is there any way of doing this?

Cheers,
Norb.
0
Comment
Question by:Norbert2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
7 Comments
 
LVL 22

Expert Comment

by:Dreamboat
ID: 18055051
No.
Sorry.
Use graphics.
0
 
LVL 1

Author Comment

by:Norbert2000
ID: 18059112
I assume you would make a graphical box (with rounded corners) and placed the table over it?  Can you do that with a table that grows and shrinks via automation?
0
 
LVL 22

Expert Comment

by:Dreamboat
ID: 18059688
Do you want the entire table to have rounded corners? Or the individual cells?
If the individual cells, you could use a graphic, create a row, then make an autotext entry from it.

I'm assuming that since no coders have chimed in, this could be painful using VBA (or at least painful to consider doing it for free?).
0
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 2000 total points
ID: 18068721
The procedure below will replace the outer table borders with a rounded rectangle. It would be somewhere between extremely difficult and impossible to make the border adjust dynamically, does it for the table passed into it.

You can test it on the first table in the active document like this:

Sub CallRC()
 RoundCorners activedocument.tables(1)
end sub

I don't know if it is rigorous enough, but it works in simple tests.

Sub RoundCorners(tbl As Table)
    Dim sh As Shape
    Dim c As Integer
    Dim r As Integer
    Dim col As Column
    Dim rw As Row
    Dim cl As Cell
    Dim tblH As Single
    Dim tblW As Single
    Dim doc As Document
    'delete any existing autoshape(s)
    On Error GoTo RoundCornersError
    tbl.Range.ShapeRange.Delete
    For r = 1 To tbl.Rows.Count
        For c = 1 To tbl.Columns.Count
            Set cl = tbl.Cell(r, c)
            If r = 1 Then
                cl.Borders(wdBorderTop).LineStyle = wdLineStyleNone
            Else
                cl.Borders(wdBorderTop).LineStyle = wdLineStyleSingle
            End If
            If c = 1 Then
                cl.Borders(wdBorderLeft).LineStyle = wdLineStyleNone
            Else
                cl.Borders(wdBorderLeft).LineStyle = wdLineStyleSingle
            End If
            If r = tbl.Rows.Count Then
                cl.Borders(wdBorderBottom).LineStyle = wdLineStyleNone
            End If
            If c = tbl.Rows.Count Then
                cl.Borders(wdBorderRight).LineStyle = wdLineStyleNone
            End If
        Next c
    Next r
    For Each col In tbl.Columns
        tblW = tblW + col.Width
    Next col
    For Each rw In tbl.Rows
        rw.HeightRule = wdRowHeightExactly
        tblH = tblH + rw.Height
    Next rw
    Set doc = tbl.Parent
    Set sh = doc.Shapes.AddShape(msoShapeRoundedRectangle, 0, 0, tblW, tblH, tbl.Range)
    sh.Fill.Transparency = 1
    sh.RelativeHorizontalPosition = wdRelativeHorizontalPositionPage
    sh.Left = tbl.Range.Information(wdHorizontalPositionRelativeToPage) - doc.PageSetup.LeftMargin
RoundCornersExit:
Exit Sub
RoundCornersError:
    Select Case Err.Number
    Case 5852 'Object not available (no shapes anchored to table range)
        Resume Next
    Case Else
        MsgBox "Unexpected error - " & Err.Description
        Resume RoundCornersExit
    End Select
 
End Sub



0
 
LVL 1

Author Comment

by:Norbert2000
ID: 18863075
I am really sorry I didn't except this solution sooner - it does exactly what I want.

Thank you very much.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It is often necessary in this forum and others to illustrate Word fields as text with the field delimiters replaced with the curly brackets that the delimiters resemble when field codes are being displayed on the document. This means that the text c…
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question