Sunday, December 17, 2017

#1 2017-11-24 03:26:00 am

akim
Member
Registered: 2010-04-04
Posts: 44

Microsoft Word Convert to table error

Microsoft Word's applescript  command to convert a text range to a table using separators fails.

Applescript:

set theList to {1, 2, 3, 4, 5, 6}
my ConvertToTableFrom:theList

on CreateParagraphDelimitedStringFromList:theList
   set AppleScript's text item delimiters to return
   set theString to theList as string
   set AppleScript's text item delimiters to ""
   theString
end CreateParagraphDelimitedStringFromList:

on ConvertToTableFrom:theList
   tell application "Microsoft Word"
       set content of text object of active document to my CreateParagraphDelimitedStringFromList:theList
       -->The following succeeds but creates a table with only one column
       convert to table (text object of active document) number of columns 3
       -->The following fails altogether, generating a Microsoft Word error that the text object of active document doesn’t understand the “convert to table” message.
       convert to table (text object of active document) separator separate by paragraphs number of columns 3
   end tell
end ConvertToTableFrom:

Microsoft Word  lists an option to this command as WdTableFieldSeparator (enumeration) with one of its constants  including  'separate by paragraphs'.
As I cannot find the reason for applescript  failing with the separator option, I would be thankful for any insight.

Offline

 

#2 2017-11-27 02:41:35 pm

t.spoon
Member
From:: BFE, Massachusetts
Registered: 2013-01-13
Posts: 211

Re: Microsoft Word Convert to table error

*** Deleted previous comment text ****

I swear I'd posted this comment on a different thread, but probably more likely user error. I had meant to post my comment on a different thread, please ignore this.

Last edited by t.spoon (2017-11-27 03:55:59 pm)


Hackintosh built February, 2012 |  Mac OS Sierra
GIGABYTE GA-Z68X-UD3H-B3 | Core i5 2500k | 16 GB DDR3 | GIGABYTE Geforce 1050 TI 4GB
250 GB Samsung 850 EVO | 4 TB RAID
Dell Ultrasharp U3011 | Dell Ultrasharp 2007FPb

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)