OberonPlace.com Forums  

Go Back   OberonPlace.com Forums > Developer Forums > VBA > CorelDRAW/Corel DESIGNER VBA

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 23-05-2011, 09:43
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default Small Text Character Count Bug X4 SP2

Hi.
Code:
msgbox activeshape.Text.Story.Characters.Count
seems to return wrong amount of characters in X4.
~John
Reply With Quote
  #2  
Old 24-05-2011, 07:37
Jeff
Guest
 
Posts: n/a
Default

Hi again John,

I also have running X4, can you describe your prob a bit more detailed? What text is in there, and what's wrong?

Thus far I can just think of paragraphs which may alter your result unexpectedly:

A quote from the docs:
Quote:
The Count property returns the number of characters in the collection, including paragraph breaks.
So each paragraph break is included in the Count, you may want to subtract that like this:

Code:
MsgBox t.Story.Characters.Count - t.Story.Paragraphs.Count
Reply With Quote
  #3  
Old 24-05-2011, 07:48
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
I was mostly pointing out the bug.
I already worked around it.

In X4 create and Artistic text shape and type "test" without quotes. In the VBA intermediate window paste msgbox activeshape.Text.Story.Characters.Count and press enter. Do the same in X5.

X4 returns 5 characters and X5 returns 4 as it should.
~John
Reply With Quote
  #4  
Old 24-05-2011, 08:03
Jeff
Guest
 
Posts: n/a
Default

Hm, I don't know if it's a bug, I guess they just changed the behavior of .Count in X5.

Since it's explicitly stated in the X4 Docs that .Count includes Paragraph breaks, it's reasonable to subtract them and the .Characters.Count - .Paragraphs.Count gives the result of 4, too.

But I can't proof this, I don't have the reference of X5 here.

If you already solved it, it doesn't matter anyways I guess How does your workaround work?
Reply With Quote
  #5  
Old 24-05-2011, 09:55
runflacruiser's Avatar
runflacruiser runflacruiser is offline
Senior Member
 
Join Date: Jun 2009
Location: Pigeon Forge, TN USA
Posts: 811
Default

Hi.
Maybe. Probably was a bug though since it was changed in X5.

My problem was that I was checking next characters for a space. In X4, code that worked in X5 just needed another check.

Code:
If i = n2 Then 'n2 is textrange count
    t.Font = strFont
ElseIf s.Text.Story.Characters(i + 1) <> "" Then 'added extra check
    If VBA.AscW(s.Text.Story.Characters(i + 1)) = 32 Then
        t.Font = strFont
    End If
..............bla bla
~John
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Jeff's Delete Small Objects macro gorgo2 Feature requests/wishlist 37 09-05-2010 22:40
Large month + 2 small bojtren Calendar Wizard 1 13-04-2010 02:32
count colors in PP Jeff Harrison Corel Photo-Paint VBA 0 17-12-2008 03:38
Reading text file, one character at a time CWCN CorelDRAW/Corel DESIGNER VBA 1 16-10-2008 14:24
Delete small objects macro Jeff Harrison New product ideas 3 19-05-2007 13:19


All times are GMT -5. The time now is 05:17.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.
Copyright © 2011, Oberonplace.com