Group:  Microsoft Word » microsoft.public.word.tables
Thread: Splitting Tables

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Splitting Tables
jpreman 05.07.2006 06:34:02
Thank you for reading this post.

I know it is possible to split a table horizontally. Is there a way a table
could be split vertically?




Re: Splitting Tables
"Stefan Blom" <no.spam[ at ]please.xyz> 05.07.2006 08:23:36
No, there is no "split table vertically" command in Word. But you can
use cut and paste to create a separate table out of selected columns
(or selected cells). Then paste at the location where you want the
table. Note that there must be at least two paragraph marks (¶)
between the location where you are pasting and the original table;
otherwise, the two tables will merge horizontally as you paste.

If you want the new table beside the old one, do the following to wrap
it: Choose Table | Table Properties. Click the Table tab, and choose
"Around" at "Text wrapping." Use the Options dialog box (click the
Options button) to position the table or drag it with the mouse.

Alternatively, you can create the illusion of a "vertically split"
table: Just insert a new column at the "break point" and remove the
horizontal borders of that column.

--
Stefan Blom
Microsoft Word MVP


"jpreman" wrote in message
news:5B7F9565-AA3A-47A1-A8DF-40E41E8AE995[ at ]microsoft.com...
[Quoted Text]
> Thank you for reading this post.
>
> I know it is possible to split a table horizontally. Is there a way
a table
> could be split vertically?
>
>
>
>










Re: Splitting Tables
"macropod" <invalid[ at ]invalid.invalid> 05.07.2006 08:37:44
Hi jpreman,

If you need to split a table because you've changed the page size and the
table's now too wide, I have a macro I've coded to deal with that. It isn't
coded to handle tables with cells merged across columns, and is designed to
replicate the left-most column for each new table. If that's what you're
trying to achieve, let me know and I'll post the code.

Cheers

--
macropod
[MVP - Microsoft Word]


"jpreman" <jpreman[ at ]discussions.microsoft.com> wrote in message
news:5B7F9565-AA3A-47A1-A8DF-40E41E8AE995[ at ]microsoft.com...
[Quoted Text]
> Thank you for reading this post.
>
> I know it is possible to split a table horizontally. Is there a way a
table
> could be split vertically?
>
>
>
>


Re: Splitting Tables
jpreman 05.07.2006 11:06:01
Hi Stefan,

Thanks for your response and it solved my issue.


"Stefan Blom" wrote:

[Quoted Text]
> No, there is no "split table vertically" command in Word. But you can
> use cut and paste to create a separate table out of selected columns
> (or selected cells). Then paste at the location where you want the
> table. Note that there must be at least two paragraph marks (¶)
> between the location where you are pasting and the original table;
> otherwise, the two tables will merge horizontally as you paste.
>
> If you want the new table beside the old one, do the following to wrap
> it: Choose Table | Table Properties. Click the Table tab, and choose
> "Around" at "Text wrapping." Use the Options dialog box (click the
> Options button) to position the table or drag it with the mouse.
>
> Alternatively, you can create the illusion of a "vertically split"
> table: Just insert a new column at the "break point" and remove the
> horizontal borders of that column.
>
> --
> Stefan Blom
> Microsoft Word MVP
>
>
> "jpreman" wrote in message
> news:5B7F9565-AA3A-47A1-A8DF-40E41E8AE995[ at ]microsoft.com...
> > Thank you for reading this post.
> >
> > I know it is possible to split a table horizontally. Is there a way
> a table
> > could be split vertically?
> >
> >
> >
> >
>
>
>
>
>
>
>
>
>
>
>
Re: Splitting Tables
jpreman 05.07.2006 11:10:02
Hi macropod,

Thanks for your response.

Though it was not my immediate issue, I have faced what you have referred at
many a times. I am sure the macro you have will be of much use to me.



"macropod" wrote:

[Quoted Text]
> Hi jpreman,
>
> If you need to split a table because you've changed the page size and the
> table's now too wide, I have a macro I've coded to deal with that. It isn't
> coded to handle tables with cells merged across columns, and is designed to
> replicate the left-most column for each new table. If that's what you're
> trying to achieve, let me know and I'll post the code.
>
> Cheers
>
> --
> macropod
> [MVP - Microsoft Word]
>
>
> "jpreman" <jpreman[ at ]discussions.microsoft.com> wrote in message
> news:5B7F9565-AA3A-47A1-A8DF-40E41E8AE995[ at ]microsoft.com...
> > Thank you for reading this post.
> >
> > I know it is possible to split a table horizontally. Is there a way a
> table
> > could be split vertically?
> >
> >
> >
> >
>
>
>
Re: Splitting Tables
"Stefan Blom" <no.spam[ at ]please.xyz> 05.07.2006 11:11:26
Glad I could help.

--
Stefan Blom
Microsoft Word MVP


"jpreman" wrote in message
news:936F77D9-0396-4593-8A4E-22E4C415C62B[ at ]microsoft.com...
[Quoted Text]
> Hi Stefan,
>
> Thanks for your response and it solved my issue.
>
>
> "Stefan Blom" wrote:
>
> > No, there is no "split table vertically" command in Word. But you
can
> > use cut and paste to create a separate table out of selected
columns
> > (or selected cells). Then paste at the location where you want the
> > table. Note that there must be at least two paragraph marks (¶)
> > between the location where you are pasting and the original table;
> > otherwise, the two tables will merge horizontally as you paste.
> >
> > If you want the new table beside the old one, do the following to
wrap
> > it: Choose Table | Table Properties. Click the Table tab, and
choose
> > "Around" at "Text wrapping." Use the Options dialog box (click the
> > Options button) to position the table or drag it with the mouse.
> >
> > Alternatively, you can create the illusion of a "vertically split"
> > table: Just insert a new column at the "break point" and remove
the
> > horizontal borders of that column.
> >
> > --
> > Stefan Blom
> > Microsoft Word MVP
> >
> >
> > "jpreman" wrote in message
> > news:5B7F9565-AA3A-47A1-A8DF-40E41E8AE995[ at ]microsoft.com...
> > > Thank you for reading this post.
> > >
> > > I know it is possible to split a table horizontally. Is there a
way
> > a table
> > > could be split vertically?
> > >
> > >
> > >
> > >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >



Re: Splitting Tables
"macropod" <invalid[ at ]invalid.invalid> 05.07.2006 13:29:16
Hi jpreman,

The following macro vertically splits all tables in a document that exceed
the horizontal print margins, replicating the first column along the way.
Single-column and two-column tables, including any generated by the split
process, are ignored. Note the 6 lines marked with an '*'. You can delete
these if column 1 is not to be replicated.

You may have to fix the odd line that gets wrapped where it shouldn't as a
result of the posting, but that shouldn't be too difficult.

Sub TableSplit()
Application.ScreenUpdating = False
Dim oLeftMargin As Single, oRightMargin As Single, oGutter As Single
Dim oPageWidth As Single, oPrintWidth As Single, oTableWidth As Single
Dim oTable, oCounter As Integer, i As Integer, j As Integer
If ActiveDocument.Tables.Count = 0 Then Exit Sub
With ActiveDocument.PageSetup
oLeftMargin = .LeftMargin
oRightMargin = .RightMargin
oGutter = .Gutter
oPageWidth = .PageWidth
End With
oPrintWidth = oPageWidth - oLeftMargin - oRightMargin - oGutter
oCounter = 1
Restart:
For j = oCounter To ActiveDocument.Tables.Count
oTable = ActiveDocument.Tables(j)
With ActiveDocument.Tables(j)
.AllowAutoFit = False
.PreferredWidth = 0
End With
oTableWidth = 0
If oTable.Columns.Count < 3 Then GoTo SkipTable
For i = 1 To oTable.Columns.Count
oTableWidth = oTableWidth + oTable.Columns(i).Width
If oTableWidth > oPrintWidth Then
oTableWidth = oTableWidth - oTable.Columns(i).Width
oTable.Columns(i).Select
With Selection
.MoveRight Unit:=wdCharacter, Count:=oTable.Columns.Count - i + 1,
Extend:=wdExtend
.Copy
.Columns.Delete
.MoveDown Unit:=wdLine, Count:=oTable.Rows.Count
.InsertParagraph
.MoveDown Unit:=wdLine, Count:=1
.Paste
End With
oCounter = j
'Delete the next 6 lines (marked '*) if column 1 is not to be
replicated
oTable.Columns(1).Select '*
With Selection '*
.Copy '*
.MoveDown Unit:=wdLine, Count:=2'*
.Paste '*
End With '*
GoTo Restart
End If
Next
SkipTable:
Next
Application.ScreenUpdating = True
End Sub

Cheers

--
macropod
[MVP - Microsoft Word]


"jpreman" <jpreman[ at ]discussions.microsoft.com> wrote in message
news:0B7F4A49-1AD5-4617-A409-27EE33F35850[ at ]microsoft.com...
[Quoted Text]
> Hi macropod,
>
> Thanks for your response.
>
> Though it was not my immediate issue, I have faced what you have referred
at
> many a times. I am sure the macro you have will be of much use to me.
>
>
>
> "macropod" wrote:
>
> > Hi jpreman,
> >
> > If you need to split a table because you've changed the page size and
the
> > table's now too wide, I have a macro I've coded to deal with that. It
isn't
> > coded to handle tables with cells merged across columns, and is designed
to
> > replicate the left-most column for each new table. If that's what you're
> > trying to achieve, let me know and I'll post the code.
> >
> > Cheers
> >
> > --
> > macropod
> > [MVP - Microsoft Word]
> >
> >
> > "jpreman" <jpreman[ at ]discussions.microsoft.com> wrote in message
> > news:5B7F9565-AA3A-47A1-A8DF-40E41E8AE995[ at ]microsoft.com...
> > > Thank you for reading this post.
> > >
> > > I know it is possible to split a table horizontally. Is there a way a
> > table
> > > could be split vertically?
> > >
> > >
> > >
> > >
> >
> >
> >


Re: Splitting Tables
jpreman 07.07.2006 15:40:02
Hi Macropod,

Thank you very much for the macro. I am sure it will be of grate help to me.

Cheers

"macropod" wrote:

[Quoted Text]
> Hi jpreman,
>
> The following macro vertically splits all tables in a document that exceed
> the horizontal print margins, replicating the first column along the way.
> Single-column and two-column tables, including any generated by the split
> process, are ignored. Note the 6 lines marked with an '*'. You can delete
> these if column 1 is not to be replicated.
>
> You may have to fix the odd line that gets wrapped where it shouldn't as a
> result of the posting, but that shouldn't be too difficult.
>
> Sub TableSplit()
> Application.ScreenUpdating = False
> Dim oLeftMargin As Single, oRightMargin As Single, oGutter As Single
> Dim oPageWidth As Single, oPrintWidth As Single, oTableWidth As Single
> Dim oTable, oCounter As Integer, i As Integer, j As Integer
> If ActiveDocument.Tables.Count = 0 Then Exit Sub
> With ActiveDocument.PageSetup
> oLeftMargin = .LeftMargin
> oRightMargin = .RightMargin
> oGutter = .Gutter
> oPageWidth = .PageWidth
> End With
> oPrintWidth = oPageWidth - oLeftMargin - oRightMargin - oGutter
> oCounter = 1
> Restart:
> For j = oCounter To ActiveDocument.Tables.Count
> oTable = ActiveDocument.Tables(j)
> With ActiveDocument.Tables(j)
> .AllowAutoFit = False
> .PreferredWidth = 0
> End With
> oTableWidth = 0
> If oTable.Columns.Count < 3 Then GoTo SkipTable
> For i = 1 To oTable.Columns.Count
> oTableWidth = oTableWidth + oTable.Columns(i).Width
> If oTableWidth > oPrintWidth Then
> oTableWidth = oTableWidth - oTable.Columns(i).Width
> oTable.Columns(i).Select
> With Selection
> .MoveRight Unit:=wdCharacter, Count:=oTable.Columns.Count - i + 1,
> Extend:=wdExtend
> .Copy
> .Columns.Delete
> .MoveDown Unit:=wdLine, Count:=oTable.Rows.Count
> .InsertParagraph
> .MoveDown Unit:=wdLine, Count:=1
> .Paste
> End With
> oCounter = j
> 'Delete the next 6 lines (marked '*) if column 1 is not to be
> replicated
> oTable.Columns(1).Select '*
> With Selection '*
> .Copy '*
> .MoveDown Unit:=wdLine, Count:=2'*
> .Paste '*
> End With '*
> GoTo Restart
> End If
> Next
> SkipTable:
> Next
> Application.ScreenUpdating = True
> End Sub
>
> Cheers
>
> --
> macropod
> [MVP - Microsoft Word]
>
>
> "jpreman" <jpreman[ at ]discussions.microsoft.com> wrote in message
> news:0B7F4A49-1AD5-4617-A409-27EE33F35850[ at ]microsoft.com...
> > Hi macropod,
> >
> > Thanks for your response.
> >
> > Though it was not my immediate issue, I have faced what you have referred
> at
> > many a times. I am sure the macro you have will be of much use to me.
> >
> >
> >
> > "macropod" wrote:
> >
> > > Hi jpreman,
> > >
> > > If you need to split a table because you've changed the page size and
> the
> > > table's now too wide, I have a macro I've coded to deal with that. It
> isn't
> > > coded to handle tables with cells merged across columns, and is designed
> to
> > > replicate the left-most column for each new table. If that's what you're
> > > trying to achieve, let me know and I'll post the code.
> > >
> > > Cheers
> > >
> > > --
> > > macropod
> > > [MVP - Microsoft Word]
> > >
> > >
> > > "jpreman" <jpreman[ at ]discussions.microsoft.com> wrote in message
> > > news:5B7F9565-AA3A-47A1-A8DF-40E41E8AE995[ at ]microsoft.com...
> > > > Thank you for reading this post.
> > > >
> > > > I know it is possible to split a table horizontally. Is there a way a
> > > table
> > > > could be split vertically?
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
>
>
>

Home | Search | Terms | Imprint | Contact
Newsgroups Reader - provided by WiredBox.Net