Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[tcom] merge cells in Powerpoint

24 views
Skip to first unread message

Peter Mayr

unread,
Jul 14, 2015, 3:50:43 PM7/14/15
to
Hi,

in the following script i want to merge all cells in the first column.
How can I do this?



package require tcom

set application [::tcom::ref createobject "PowerPoint.Application"]
$application Visible 1

set presentations [$application Presentations]
set presentation [$presentations Add]
set slides [$presentation Slides]
set slide [$slides Add 1 12]
set shapes [$slide Shapes]
set shape [$shapes AddTable 5 6 20 20 300 150]
set table [$shape Table]
$table ApplyStyle 2D5ABB26-0587-4C30-8999-92F81FD0307C 1

#Loop through all the rows
foreach row {1 2 3 4 5} {
#Loop through all the cells in the row
foreach column {1 2 3 4 5 6} {
set cell [$table Cell $row $column]
set textframe [[$cell Shape] TextFrame]
set textrange [$textframe TextRange]
set txt [concat $row $column]
set tfont [$textrange Font]
$tfont Bold 1
$tfont Size 12
$tfont Name Calibri
$textframe VerticalAnchor 3
[$textrange ParagraphFormat] Alignment 3
[[$shape Fill] ForeColor] RGB 11393254
$textrange Text $txt
}
}
set cell [$table Cell 5 1]
$cell Merge 1 1

$presentation SaveAs {e:\test.pptx}
$presentation Close
$application Quit
unset application
0 new messages