![]() |
#1
|
||||
|
||||
![]()
Hi.
Any ideas I get a "Object no longer exists" with this code when more than one table is on the page? The code is supposed to change all text in tables on the page to red. Also is there any cql to narrow the shaperange down to only the text inside? Thanks. -John Code:
Sub MyTableTextColorChanger() Dim s As Shape, sr As ShapeRange, i As Long, j As Long Dim sText As Shape, sSel As Shape Set sr = ActivePage.Shapes.FindShapes(Query:="@type='plugin:table'") For i = 1 To sr.count For j = 1 To sr(i).Custom.cells.count Set s = sr(i).Custom.cells(j).TextShape If s.Type <> cdrCustomShape And Len(s.text.Story.Characters.All) Then s.Fill.UniformColor.RGBAssign 255, 0, 0 End If Next j Set s = sr(i).Custom.cells(i).TextShape Next i End Sub |
#2
|
||||
|
||||
![]()
How about something like this:
Code:
Sub MyTableTextColorChanger() Dim s As Shape, sr As ShapeRange Set sr = ActivePage.Shapes.FindShapes(Query:="@type='plugin:table' and (@com.ParentGroup = null or @com.ParentGroup.Type <> 21)") 'Return just the tables Set sr = sr.Shapes.FindShapes(Query:="@type='text:paragraph' and !@com.Text.Story.Text.Trim().empty()") 'Find all text For Each s In sr s.Fill.UniformColor.RGBAssign 255, 0, 0 Next s End Sub -Shelby |
#3
|
||||
|
||||
![]()
Hi.
That's 100% exactly what I had in mind. I couldn't seem to get my first cql query for the tables complete. As for your second query can you explain this: !@com.Text.Story.Text.Trim().empty() -John |
#4
|
||||
|
||||
![]()
Nope, because it is magic. ;-) Just kidding.
Basically I need a way to test if the paragraph text had any text in it. So: Code:
@com.Text.Story Code:
.Trim() Code:
.empty() Code:
!@ |
#5
|
||||
|
||||
![]() Quote:
Also, I know we heard this question before...Any new docs on CQL? -John |
#6
|
||||
|
||||
![]()
Since we are not passing anything, the () would be optional. You could rewrite like this:
Code:
Sub MyTableTextColorChanger() Dim s As Shape, sr As ShapeRange Set sr = ActivePage.Shapes.FindShapes(Query:="@type='plugin:table' and (@com.ParentGroup = null or @com.ParentGroup.Type <> 21)") 'Return just the tables Set sr = sr.Shapes.FindShapes(Query:="@type='text:paragraph' and !@com.Text.Story.Text.Trim.empty") 'Find all text sr.ApplyUniformFill CreateRGBColor(255, 0, 0) End Sub Last edited by shelbym; 19-01-2011 at 15:38. Reason: pasted the wrong code |
#7
|
||||
|
||||
![]()
Shrinking it even more.
I like that...I forgot I can do that to sr's -John |
#8
|
||||
|
||||
![]() Quote:
Using Corel Query Language (CQL) to search for objects in CorelDRAW documents -Shelby |
![]() |
Tags |
cells, tables |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Recorder not working | runflacruiser | Macros/Add-ons | 2 | 19-01-2011 08:32 |
Working With Text | shelbym | Code Critique | 2 | 12-07-2006 08:37 |
ConvertToCurves not working. | rsriram22 | CorelDRAW/Corel DESIGNER VBA | 2 | 29-06-2006 10:40 |
Tables in Corel Draw 10 | betob | New product ideas | 0 | 04-09-2003 05:46 |