Author Topic: {Challenge}Get the textstrings in each line of the mtext  (Read 12153 times)

0 Members and 1 Guest are viewing this topic.

xiaxiang

  • Guest
{Challenge}Get the textstrings in each line of the mtext
« on: March 07, 2013, 01:35:04 AM »
HI
I Assume that there was one mtext with group code as follow
Code: [Select]
((-1 . <图元名: 7ed62ec8>) (0 . "MTEXT") (330 . <图元名: 7ed62c10>) (5 . "59")
(100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbMText") (10
56.4981 -14.2706 0.0) (40 . 3.5) (41 . 15.9327) (46 . 20.4843) (71 . 1) (72 .
5) (1 . "abc        abc abc") (7 . "Standard") (210 0.0 0.0 1.0) (11 1.0 0.0
0.0) (42 . 9.33333) (43 . 15.1667) (50 . 0.0) (73 . 1) (44 . 1.0))
Now we know the textstrings content is "abc        abc abc".
Note that there isn't "\\p" Included in the textstrings content .
So the question:how can I get the textstrings in each line of the mtext and return the list of the result?
In this example the return value is ("abc        " "abc " "abc").
I want to know if someone can do that as a Challenge and do help for me.
It seems like  that  we can use explode command ,but any other suggestion?
Sorry for my bad English.
The sample picture and file are as Attachments.
Regards Xia

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #1 on: March 07, 2013, 05:29:57 AM »
This may do the trick .  ( considering the space as a start for another word ) so it is not typical at all .

Code - Auto/Visual Lisp: [Select]
  1. (defun Deconstruct_Strings (string delimiter / pos lst)
  2. ;;;;;   Author  :  Tharwat Al Shoufi            ;;;;;
  3. ;;;;; Sub-Function to separate a string into  ;;;;;
  4. ;;;;; a list acoording to the Delimiter         ;;;;;
  5.   (while (setq pos (vl-string-search delimiter string 0))
  6.     (progn (setq lst (cons (substr string 1 pos) lst))
  7.            (setq string (substr string (+ pos 2) (strlen string)))
  8.     )
  9.   )
  10.   (if string
  11.     (setq lst (cons string lst))
  12.   )
  13.   (setq lst (reverse lst))
  14. )
  15.  
  16. (defun c:Test (/ ss)
  17.   (if (and (setq ss (car (entsel "\n Select Mtext :"))) (eq (cdr (assoc 0 (entget ss))) "MTEXT"))
  18.     (vl-remove "" (Deconstruct_strings (cdr (assoc 1 (entget ss))) " "))
  19.   )
  20. )
  21.  
« Last Edit: March 07, 2013, 05:33:11 AM by Tharwat »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #2 on: March 07, 2013, 06:35:32 AM »
This would be anything but easy. Just consider all the formatting code that can be used in mtexts! The question is: what is your goal?

xiaxiang

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #3 on: March 07, 2013, 08:52:36 AM »
This would be anything but easy. Just consider all the formatting code that can be used in mtexts! The question is: what is your goal?
I want to explode this mtext with no other formats(even no spaces)to single texts and hold their own  locations.This is the real subject of this topic.
Thanks.
xia

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #4 on: March 07, 2013, 09:04:22 AM »
I want to explode this mtext with no other formats(even no spaces)to single texts and hold their own  locations.This is the real subject of this topic.

Why not use the explode command?

PKENEWELL

  • Bull Frog
  • Posts: 318
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #5 on: March 07, 2013, 09:21:15 AM »
This may do the trick .  ( considering the space as a start for another word ) so it is not typical at all .

Code - Auto/Visual Lisp: [Select]
  1. (defun Deconstruct_Strings (string delimiter / pos lst)
  2. ;;;;;   Author  :  Tharwat Al Shoufi            ;;;;;
  3. ;;;;; Sub-Function to separate a string into  ;;;;;
  4. ;;;;; a list acoording to the Delimiter         ;;;;;
  5.   (while (setq pos (vl-string-search delimiter string 0))
  6.     (progn (setq lst (cons (substr string 1 pos) lst))
  7.            (setq string (substr string (+ pos 2) (strlen string)))
  8.     )
  9.   )
  10.   (if string
  11.     (setq lst (cons string lst))
  12.   )
  13.   (setq lst (reverse lst))
  14. )
  15.  
  16. (defun c:Test (/ ss)
  17.   (if (and (setq ss (car (entsel "\n Select Mtext :"))) (eq (cdr (assoc 0 (entget ss))) "MTEXT"))
  18.     (vl-remove "" (Deconstruct_strings (cdr (assoc 1 (entget ss))) " "))
  19.   )
  20. )
  21.  

@Tharwat

Just getting DXF code 1 will not do the trick if the text string is greater than 250 characters. if the text string length is greater than 250, then you must iterate through DXF code 3, which holds the rest of the string in 250 character chunks. Formatting is a different matter, after retrieving all the text, you have to strip the formatting. Lee Mac's unformat string function: http://www.lee-mac.com/unformatstring.html can be used for that.

It's a whole different matter to preserve the formatting, and put it back into the string afterwards. It can be done - but it is complex, you have to write a new program that replaces the formatting with placeholders in a list along with the string, then replaces the formatting afterwards before recombining the string.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

mkweaver

  • Bull Frog
  • Posts: 352
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #6 on: March 07, 2013, 11:02:49 AM »
Breaking the text down to lines can be done with explode and vl-string-trim. Exploding to individual words is a bit more work.
[ :-Dquote author=xiaxiang link=topic=44128.msg493796#msg493796 date=1362664356]
This would be anything but easy. Just consider all the formatting code that can be used in mtexts! The question is: what is your goal?
I want to explode this mtext with no other formats(even no spaces)to single texts and hold their own  locations.This is the real subject of this topic.
Thanks.
xia
[/quote]

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #7 on: March 07, 2013, 11:26:08 AM »
This what I have been using on Plain Text. (explode Mtext)
Code - Auto/Visual Lisp: [Select]
  1. ;;  CAB 05/12/2011
  2. ;;  Break dText into text words
  3.  
  4. ;; NOTE, will only work with LEFT justification now
  5.  
  6. (defun c:t2w() (c:text2words))
  7. (defun c:text2words (/ ang elst ent wordlst pt10 pt11 spcwid wid)
  8.   ;;  phraser by CAB
  9.   (defun sparser (str delim / ptr lst)
  10.     (while (setq ptr (vl-string-search delim str))
  11.       (setq lst (cons (substr str 1 ptr) lst))
  12.       (setq str (substr str (+ ptr 2)))
  13.     )
  14.     (reverse (cons str lst))
  15.   )
  16.   ;;  Strip these dxf code pairs from original list
  17.   (defun dxfstrip (el)
  18.     (vl-remove-if '(lambda (pr) (member (car pr) '(-2 -1 5 102 300 330 331 340 350 360 410))) el)
  19.   )
  20.  
  21.   (defun getwidth(el)
  22.     (abs (apply '- (mapcar 'car (textbox el))))
  23.   )
  24.  
  25.  
  26.   (if (and (setq ent (entsel "\nSelect the text"))
  27.            (setq elst (entget (car ent)))
  28.            (= (cdr (assoc 0 elst)) "TEXT")
  29.       )
  30.     (progn
  31.       (entdel (car ent))
  32.       (setq elst (dxfstrip elst))
  33.       (setq txt (cdr (assoc 1 elst)))
  34.       (setq wordlst (vl-remove "" (sparser txt " ")))
  35.       (setq ang (cdr (assoc 50 elst))
  36.             pt10 (cdr (assoc 10 elst))
  37.             pt11 (cdr (assoc 11 elst))
  38.       )
  39.       ;;  get approx width a space to seperate new text with
  40.       (setq elst (subst '(1 . "hl") (assoc 1 elst)  elst))
  41.       (setq spcwid (getwidth elst))
  42.  
  43.       (foreach word wordlst
  44.         (entmake (setq elst (subst (cons 1 word) (assoc 1 elst)  elst)))
  45.         (setq wid (getwidth elst)
  46.               pt10 (polar pt10 ang (+ wid spcwid))
  47.               pt11 (polar pt11 ang (+ wid spcwid))
  48.               elst (subst (cons 10 pt10) (assoc 10 elst)  elst)
  49.               elst (subst (cons 11 pt11) (assoc 11 elst)  elst)
  50.         )
  51.       )
  52.     )
  53.     (princ "\nMissed or Not plain TEXT.")
  54.   )
  55.  
  56.   (princ)
  57. )
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #8 on: March 07, 2013, 01:18:03 PM »
Nice code Charles  8-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Tharwat

  • Swamp Rat
  • Posts: 710
  • Hypersensitive
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #9 on: March 07, 2013, 01:29:19 PM »
CAB , I think the OP is talking about Mtext and not Text .

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #10 on: March 07, 2013, 01:29:43 PM »
Nice one CAB  :-)

This was my version (I'll add it to my site when I get a chance!)


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #11 on: March 07, 2013, 03:16:32 PM »
Thanks fellas, Nice one Lee.  8-)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

ribarm

  • Gator
  • Posts: 3274
  • Marko Ribar, architect
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #12 on: March 07, 2013, 05:00:47 PM »
Although it functions as expected, it could be better if all split words were to be counted including " " words...

Code - Auto/Visual Lisp: [Select]
  1. (defun _splitwords ( str / pos )
  2.     (if (setq pos (vl-string-position 32 str))
  3.         (cons (cons 1 (substr str 1 (if (eq pos 0) 1 pos))) (_splitwords (substr str (+ (if (eq pos 0) 1 pos) 1))))
  4.         (list (cons 1 str))
  5.     )
  6. )
  7.  

And at the end of routine, you just erase those empty text entities :

Code - Auto/Visual Lisp: [Select]
  1. (vl-cmdf "_.erase" (ssget "_X" '((0 . "TEXT") (1 . " "))) "")
  2.  

This minor modifications I made for my purposes, just thinking that if the words are separated with more spaces, this variant is better (my opinion)...

Cheers, and thank you Lee...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

xiaxiang

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #13 on: March 07, 2013, 08:45:27 PM »
This may do the trick .  ( considering the space as a start for another word ) so it is not typical at all .
Thanks Tharwat!Your codes work well with the textstrings which contain spaces in them as the Attachments of my topic supplied.
If process mtexts which haven't any spcace in their textstrings,the only way I think is explode command
Regards.

I want to explode this mtext with no other formats(even no spaces)to single texts and hold their own  locations.This is the real subject of this topic.

Why not use the explode command?
Is there any other way to change mtext to texts properly?
It seems like only explode command can do that thing.
Regards.

xiaxiang

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #14 on: March 07, 2013, 09:05:05 PM »
This what I have been using on Plain Text. (explode Mtext)

Nice one CAB  :-)
This was my version (I'll add it to my site when I get a chance!)

Hi,Charles Hi,Lee
All the codes you supplied are designed to process Dtext.
I hope that Mtext could also be done well.
So please allow me to change the OP to "How to break mText into text words".
You'll tell me that using the explode command.
 :-P

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #15 on: March 09, 2013, 01:26:15 AM »
It seems like only explode command can do that thing.
I seem to remember that MText actually stores the portions as DText inside an anonymous block definition. But for the love of Pete ... I can't seem to find this. Perhaps I was thinking of something else  ::)
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

xiaxiang

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #16 on: March 09, 2013, 02:05:43 AM »
It seems like only explode command can do that thing.
I seem to remember that MText actually stores the portions as DText inside an anonymous block definition. But for the love of Pete ... I can't seem to find this. Perhaps I was thinking of something else  ::)
Really nice! As far as I've know the textstring of Mtext is stored as one combination.Any further information is welcome.
Xia

fervour

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #17 on: January 06, 2015, 05:13:22 PM »
I have a sentence in mtext and all the words are separated with TAB spacer. What is the modification to make so that it only breaks the tabs between words and not regular spaces.

Thank you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #18 on: January 07, 2015, 12:02:06 AM »
I have a sentence in mtext and all the words are separated with TAB spacer. What is the modification to make so that it only breaks the tabs between words and not regular spaces.

Thank you.
Lee's code should do the trick, just edit the _splitwords fuction to include tabs.

*untested*
Code: [Select]
    (defun _splitwords ( str / pos )
        (if (setq pos (vl-string-position 9 str)) ;alanjt edit 32 to 9 (search for tab instead of space
            (cons (cons 1 (substr str 1 pos)) (_splitwords (substr str (+ pos 2))))
            (list (cons 1 str))
        )
    )
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #19 on: January 07, 2015, 04:10:20 AM »
Thanks Alan -

Since the difference between the total text width and the sum of the width of each word is divided equally between the words, then providing all of the words are separated by tabs, the modification should work. Obviously, if one has a combination of spaces & tabs, the new text items will be spaced using an average of the space between each of the original words.

Lee

fervour

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #20 on: January 07, 2015, 11:30:56 AM »
Thanks for the suggestion.

I tried, but the code only look after Dtext, and the Tab delimiter turns into space after being converted from mtext to dtext.
I have a single mtext entity with 2 lines for example:

1st line of mtext: Today[Tab]is[space]a[space]great[tab]day
2nd line of mtext: Tomorrow[Tab]will[space]also[space]be[space]a[space]great[tab]day

I am hoping to break the above by looking at [tab] only.
So the above result will convert 1 mtext to 6 dtext or 6 mtext:

Today
is a great
day
Tomorrow
will also be a a great
day

(no need to be in separate new lines like above, I just showed like as an example).

Thanks again  :-)

ronjonp

  • Needs a day job
  • Posts: 7529
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #21 on: January 07, 2015, 11:41:44 AM »
This works for me:
Code - Auto/Visual Lisp: [Select]
  1. (defun _splitwords (str del / pos)
  2.   ;; RJP mod vl-string-search for readability and delimiter argument
  3.   (if (setq pos (vl-string-search del str))
  4.     (cons (substr str 1 pos) (_splitwords (substr str (+ pos (1+ (strlen del))))del))
  5.     (list str)
  6.   )
  7. )
  8. (setq str (vla-get-textstring (vlax-ename->vla-object (car (entsel)))))
  9. (_splitwords str "\t")
  10.  
  11.  
  12. ;; "Tomorrow\twill also be a great\tday"
  13. ;; Returns
  14. ;; ("Tomorrow" "will also be a great" "day")
« Last Edit: January 07, 2015, 12:10:14 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #22 on: January 07, 2015, 12:00:16 PM »
This works for me:
Code - Auto/Visual Lisp: [Select]
  1. (defun _splitwords (str del / pos)
  2.   ;; RJP mod vl-string-search for readability and delimiter argument
  3.   (if (setq pos (vl-string-search del str))
  4.     (cons (substr str 1 pos) (_splitwords (substr str (+ pos 2))del))
  5.     (list str)
  6.   )
  7. )
  8. (setq str (vla-get-textstring (vlax-ename->vla-object (car (entsel)))))
  9. (_splitwords str "\t")
  10.  
  11.  
  12. ;; "Tomorrow\twill also be a great\tday"
  13. ;; Returns
  14. ;; ("Tomorrow" "will also be a great" "day")
Be aware that the +2 would fail to yield desired results if the delimiter exceeded the intended single digit.

eg.
Code: [Select]
Command: (_splitwords "i_-_love_-_pizza" "_-_")
("i" "-_love" "-_pizza")

This is pointless in this situation, and a simple strlen would fix the issue, but I just thought it was worth mentioning.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7529
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #23 on: January 07, 2015, 12:05:10 PM »
Ah yes :) thanks Alan .. I'll modify above.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #24 on: January 07, 2015, 12:09:23 PM »
Ah yes :) thanks Alan .. I'll modify above.
:) I was mainly just looking for an excuse to express admiration for my one true love.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

fervour

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #25 on: January 07, 2015, 12:49:17 PM »
The lisp won't let me select Mtext though...?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #26 on: January 07, 2015, 01:04:50 PM »
The lisp won't let me select Mtext though...?


Sure it does.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

ronjonp

  • Needs a day job
  • Posts: 7529
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #27 on: January 07, 2015, 01:05:23 PM »
Ah yes :) thanks Alan .. I'll modify above.
:) I was mainly just looking for an excuse to express admiration for my one true love.
Ummmm ..  :oops:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

fervour

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #28 on: January 07, 2015, 01:35:11 PM »
I used Lee's code and updated the _splitwords section. What did I do wrong?

Code: [Select]
(defun c:s2w ( / _splitwords _textwidth ang dxf ent enx fun inc lst pnt sel spc tot wid )

(defun _splitwords (str del / pos)
  ;; RJP mod vl-string-search for readability and delimiter argument
  (if (setq pos (vl-string-search del str))
    (cons (substr str 1 pos) (_splitwords (substr str (+ pos (1+ (strlen del))))del))
    (list str)
  )
)

(setq str (vla-get-textstring (vlax-ename->vla-object (car (entsel)))))
(_splitwords str "\t")

    (defun _textwidth ( enx )
        ((lambda ( lst ) (- (caadr lst) (caar lst))) (textbox enx))
    )

    (if (setq sel (ssget "_:L" '((0 . "TEXT") (-4 . "<NOT") (-4 . "<OR") (72 . 3) (72 . 4) (72 . 5) (-4 . "OR>") (-4 . "NOT>"))))
        (repeat (setq inc (sslength sel))
            (setq ent (ssname sel (setq inc (1- inc)))
                  enx (entget ent)
                  tot 0.0
                  lst nil
            )
            (foreach item (_splitwords (cdr (assoc 1 enx)))
                (setq dxf (entget (entmakex (subst item (assoc 1 enx) enx)))
                      wid (_textwidth dxf)
                      tot (+ tot wid)
                      lst (cons (cons dxf wid) lst)
                )
            )
            (if (< 1 (length lst))
                (progn
                    (setq wid (_textwidth enx)
                          spc (/ (- wid tot) (float (1- (length lst))))
                          lst (reverse lst)
                          ang (cdr (assoc 50 enx))
                    )
                    (if
                        (and
                            (= 0 (cdr (assoc 72 enx)))
                            (= 0 (cdr (assoc 73 enx)))
                        )
                        (setq pnt (cdr (assoc 10 enx)))
                        (setq pnt (cdr (assoc 11 enx)))
                    )
                    (cond
                        (   (= (cdr (assoc 72 enx)) 0)
                            (setq fun (lambda ( a b ) (+ spc (cdr a))))
                        )
                        (   (= (cdr (assoc 72 enx)) 1)
                            (setq fun (lambda ( a b ) (+ spc (/ (+ (cdr a) (cdr b)) 2.0)))
                                  pnt (polar pnt (+ ang pi) (/ (- wid (cdar lst)) 2.0))
                            )
                        )
                        (   (= (cdr (assoc 72 enx)) 2)
                            (setq fun (lambda ( a b ) (+ spc (cdr b)))
                                  pnt (polar pnt (+ ang pi) (- wid (cdar lst)))
                            )
                        )
                    )
                    (mapcar
                        (function
                            (lambda ( a b / dxf )
                                (setq dxf (car a)
                                      dxf (subst (cons 10 pnt) (assoc 10 dxf) dxf)
                                      dxf (subst (cons 11 pnt) (assoc 11 dxf) dxf)
                                      pnt (polar pnt ang (fun a b))
                                )
                                (entmod dxf)
                            )
                        )
                        lst (append (cdr lst) '((nil . 0.0)))
                    )
                    (entdel ent)
                )
            )
        )
    )
    (princ)
)
(princ)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #29 on: January 07, 2015, 07:41:46 PM »
Ah yes :) thanks Alan .. I'll modify above.
:) I was mainly just looking for an excuse to express admiration for my one true love.
Ummmm ..  :oops:
I love you too, but I love pizza more.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

ronjonp

  • Needs a day job
  • Posts: 7529
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #30 on: January 08, 2015, 12:25:36 AM »
Ah yes :) thanks Alan .. I'll modify above.
:) I was mainly just looking for an excuse to express admiration for my one true love.
Ummmm ..  :oops:
I love you too, but I love pizza more.
Agreed .. I love pizza more too :) .

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

RAYAKMAL

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #31 on: January 08, 2015, 12:52:30 AM »
Nice one CAB  :-)

This was my version (I'll add it to my site when I get a chance!)



Lee... Thanks. That's exactly what I wanted a few days ago :D

Here's my story:
When there's a need to distribute standard drawings to a contractor, I usually export them to WMF and then I use MS WORD to create the pdf.
It suits my need.  Unfortunately some portion of the pdf consist of paragraph text still can be disassembled from pdf.
With your code, problem solved. Texts are words, not one sentence.
 
« Last Edit: January 08, 2015, 08:03:24 PM by RAYAKMAL »

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #32 on: January 08, 2015, 06:06:24 PM »
I'm delighted that you find it useful RAYAKMAL  :-)

FWIW, I subsequently published the program to my site as 'Text to Words' - though, I believe the code published on my site is mostly unchanged from the version posted in this thread.

fervour

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #33 on: January 08, 2015, 07:05:55 PM »
I tried, but I am still not able to select Mtext using the code above....  :oops:

fervour

  • Guest
Re: {Challenge}Get the textstrings in each line of the mtext
« Reply #34 on: January 12, 2015, 02:34:17 PM »
Hi ronjonp,

Could you please help me why I could not select Mtext?

Thank you