🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #9270

Styling tables without(!) table styles and cell styles

#9270
From: Martin Fischer*
Date: Thu, 24 Aug 2006 05:21
48 lines
2691 bytes
This is a continuation of "Styling tables with table styles and cell styles" <http://www.adobeforums.com/cgi-bin/webx/.3bc16072>

4. Alternative method to store and restore table and cell properties
At least I have tried to do my own way to store (and restore) table and cell properties.
I tried to store table properties like this:

 
var myTableProps = myTable.properties.toSource() 


The result is something like this (shortened):

({[...], storyOffset:1, index:0, headerRowCount:0, footerRowCount:0, height:22.2477915355261,  
width:99.6472222222222, [...] parent:resolve(�/document[@name=\�myDoc.indd\�]//text-frame[@id=250]�)}) 


Now there are some properties like "index", "bodyRowCount", "columnCount", "id", "contents", "parent" which I don't want to apply to another table. So I tried to cut out these properties of the string first making an array and then use the splice()-function to cut them out:

 
// myArray = array of properties of myTable 
// theDelProp = array with names of some properties to cut out of myArray 
var myArray =  myTableProps.split(", ");

for (i = myArray.length-1; i>= 0; i--) 
{ 
	for (j = 0; j< theDelProp.length; j++) 
	{ 
		if (myArray[i].substring(0,theDelProp[j].length) ==  theDelProp[j] ) 
		{ 
			myArray.splice(i,1) 
			break; 
		} 
	} 
} 




This works with the tables properties. But I have got problems with the cell properties. There is a property called gradientFillStart which has an array of two units for the starting point or center point of a gradient, in "myCell.properties.toSource()" divided by ", " too.

How to avoid to make two elements of an array of the string "gradientFillStart:[69.2, 85.0166666666667]" when making an array with splitting a string by a comma? The comma divides two properties like "topInset" and "leftInset" but also devides a subArray like the starting point of a gradient.

Restoring goes like this:
1. reading the lines of the properties file (txt)
2. eval("myTable." + theLine.split(":").join(" = ") );

Thanks for paying attention to my extensive explanation.
Martin
Technical Details
Message-ID: <3bc16077.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,edd75ed1deae000,start
X-Google-Attributes: gidf939a,public
X-Google-Language: ENGLISH,ASCII
From: "Martin Fischer*" <martin.fischer@online.de>
Newsgroups: adobe.scripting.indesign
Subject: Styling tables without(!) table styles and cell styles
Message-ID: <3bc16077.-1@webcrossing.la2eafNXanI>
Date: Wed, 23 Aug 2006 22:21:37 -0700
Lines: 57
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
Path: arc1-ca.pugleaf.net!g2news2.google.com!news3.google.com!news2.volia.net!news.ecp.fr!news.stben.net!webcrossing