I've hit a bit of a roadblock when it comes to creating swatches based on entries in a text file. I can get the file to be read okay, but when it comes to actually creating the swatch (or editing an existing one) it fails.
Assuming the value of c1 is "0,100,100,5", this is editing the existing one:
set swatch ("CLIENT1") to c1
And this is creating a new one:
make new color with properties {model:process, space:CMYK, color value:{c1}, name:"CLIENT1"}
Any help would be hugely appreciated.
Because the variable c1 is a string, not a list.
You need a list wich contains integer.
Here is a solution :
set c1 to "0,100,100,5"
set c1 to run script "{" & c1 & "}"
-- Edit :
Here's how to change the color of an existing swatch
tell active document
set color value of swatch "CLIENT1" to c1 -- change one property
-- or change properties
set properties of swatch "CLIENT1" to {model:process, space:CMYK, color value:c1}
Related
I want to display a object as red or green based on a 1 or 0 cell value inside a CSV/XLSL file. Is this possible? If so, is there a tutorial that solved this problem.
I am attempting to user SpreadsheetML to generate an Excel report server side and download the report via the browser. I have everything working and am getting the files I need downloaded. However, I run into a problem when I attempt to merge cells in one of the sheets I am creating. I have found two different syntaxes online and tried them both without success. I save the files as .xml files and the will open fine and show the expected data but the cells are not merged.
The first syntax uses the "mergeAcross" qualifier on the element and is supposed to merge the number of cells specified into the current cell. The second syntax using the element. I have pasted the actual xml code below for both attempts. If I can figure out what the XML should be then I can create it programatically easily.
Version 1
<?xml version='1.0'?>
<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Worksheet ss:Name='Distribution List Overview'>
<ss:Table>
<ss:Row>
<ss:Cell mergeAcross="2"><ss:Data ss:Type="String">First Cell Entry</ss:Data></ss:Cell>
<ss:Cell><ss:Data ss:Type="String">Third Cell</ss:Data></ss:Cell>
</ss:Row>
</ss:Table>
</ss:Worksheet>
</ss:Workbook>
Version 1
<?xml version='1.0'?>
<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<ss:Worksheet ss:Name='Distribution List Overview'>
<ss:Table>
<ss:Row>
<ss:Cell><ss:Data ss:Type="String">First Cell Entry</ss:Data></ss:Cell>
<ss:Cell><ss:Data ss:Type="String">Third Cell</ss:Data></ss:Cell>
</ss:Row>
</ss:Table>
<mergeCells count="2">
<mergeCell ref="A1:B1"/>
</mergeCells>
</ss:Worksheet>
</ss:Workbook>
Both approaches above fail to create a merged cell. I am expecting to get "First Cell Entry" filling cells A1 and B1 with "Third Cell" in cell C1. Instead I get "First Cell Entry" in cell A1 and "Third Cell" in cell B1. Any help or suggestions would be greatly appreciated. This is the only remaining item I need to get some legacy code working and I do not want to convert the entire report over to OpenXML SDK code.
Try replacing mergeAcross with ss:MergeAcross. In other words, use:
<ss:Cell ss:MergeAcross="2"><ss:Data ss:Type="String">First Cell Entry</ss:Data></ss:Cell>
Also, you may notice that to get "A1:B1" merged cell you need to set ss:MergeAcross value to 1, not 2.
Mario's answer remains the correct answer to this question.
However, since there is decent traffic hitting this question I thought I would add some sample code for a few additional operations that I had to dig up when working on this report.
Here is an example of how to add styling information to a file. Add a block like the one below into your file immediately after the workbook element
<?xml version='1.0'?><ss:Workbook xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet'>
<ss:Styles>
<ss:Style ss:ID='1'>
<ss:Font ss:Bold='1'/>
<ss:Alignment ss:Horizontal='Center'/>
</ss:Style>
</ss:Styles>
<ss:Worksheet ss:Name='Distribution List Overview'>
The defines a style to set the font-weight bold and to horizontally center the text in each cell. You seem to be able to add an arbitrary number of style parameters to the block and should be able to specify pretty much anything supported by Excel. You'll have to do some research to find out what the correct element names are but they seem to closely parallel Excel commands so guessing is not as hard as it sounds.
You can add this to a Cell or Row by appending the style descriptor the the target element as shown below
<ss:Cell ss:StyleID='1'>
To specify horizontal alignment and wrapped text declare another style block in between the 'ss:Styles' and '/ss:Styles' elements and give it a unique identifier
<ss:Style ss:ID='3'>
<ss:Alignment ss:Vertical='Bottom' ss:WrapText='1'/>
</ss:Style>
Borders can be created using the following style structure
<ss:Style ss:ID='4'>
<ss:Font ss:Bold='1'/>
<ss:Borders>
<ss:Border ss:Position='Bottom' ss:LineStyle='Continuous' ss:Weight='1'/>
<ss:Border ss:Position='Left' ss:LineStyle='Continuous' ss:Weight='1'/>
<ss:Border ss:Position='Right' ss:LineStyle='Continuous' ss:Weight='1'/>
<ss:Border ss:Position='Top' ss:LineStyle='Continuous' ss:Weight='1'/>
</ss:Borders>
When assigned to a Cell this will set the text font to bold and apply borders on all sides with a normal weight. Adjust the Weight parameter to make the borders bolder.
Finally, I spent quite a while investigating how to add multiple records to a single cell. As far as I can tell you cannot nest Tables inside a cell so I had to figure out how to encode an alt-enter to cause line feeds inside the cell. This requires a custom style as well as some special text to be inserted inline. You need to enable line wrap as I showed above and then use the '
' string to separate your lines. The block below will display two names in the specified cell on two lines using the example style specified above
<ss:Cell ss:StyleID='3'>
<ss:Data ss:Type='String'>Jane Doe
Janet Doe</ss:Data>
</ss:Cell>
I have not managed to figure out a way to apply multiple styles to a single element so I have had to create several styles, some with very minor differences, and assign each cell the specific style ID it requires to format everything correctly. For example, I had to create a style with normal text and normal weight borders, one with bold text and normal borders and one with bold text and bold borders since I could not figure out a way to apply the font weight and the border weight separately.
I have created a paragraph text in after effects using Extendscript
For example i have a text "HI". I need to give color for "H" as red [1,0,0] and "I" as green [0,1,0].
I have checked everywhere ,. where i can find out that i can change the text color in whole rather than individually ! is there anything that can be done?
I need to change color of each and individual characters using script
It looks like it's not possible. The text in a text layer is a TextDocument object, and when you look at the AE scripting guide it says
TextDocument fillColor attribute
textDocument.fillColor
Description
The text layer’s fill color, as an array of [r, g, b] floating-point values. For example, in an 8-bpc project, a red
value of 255 would be 1.0, and in a 32-bpc project, an overbright blue value can be something like 3.2.
NOTE: If the text layer has different fill color settings for each character, this attribute returns the setting for the first character. Also, if you change the value, it resets all characters in the text layer to the specified setting.
Type
Array [r, g, b] of floating-point values; read/write.
The important bit is the Note. The same thing applies for all the text attributes like fontSize, fill, stroke &c., &c..
So for some reason you can't access the style attributes for anything but the first character in a line of text. Are you annoyed? I am. Perhaps log a bug with Adobe—it will be completely futile, but you might feel better.
I have a view that displays data from several categories, where the category (bug severity in my case) is color-coded into the background color of individual entries. Now I'd like to apply the same background color to the category line itself.
As the column setting the background color for the rest of the line isn't displayed in category rows, the setting isn't applied. Is there a workaround for that?
Taken from: http://www-10.lotus.com/ldd/nd6forum.nsf/0/2765b9380021c666852572d800589f9d?OpenDocument
Here is an awkward method that works to color your category rows
differently.
Put a column before all the categorized columns. This will be your color column. Check the Use Value as Color property of the column
properties.
Use one of the functions below:
#If(#IsCategory("any")="any";any;1:1:1)
#If(#IsCategory("x")="y";z;1:1:1)
Note: in the function above, where the word "any" appears, or "x" "y"
and "z", it can be anything, matching or not. It will always evaluate
to false. If you try just #IsCategory, it will error out because that
doesn't return true. And no match you try will ever cause a true
comparison.
That said, the result is that all rows will be colored black if they
are not categories. This overrides the default text color. If you want
another color than black, then adjust the 1:1:1 accordingly
(red:green:blue up to 255 for each position, red= 255:0:0)
Now go to any column and set the text color to the row you want your
categorized rows to appear in, and click Apply to All. Voila!
I was trying to figure out how to do this programmatically and then I wondered, why not just borrow from the mail template? I'd like to suggest you check into how the ColorProfile is used there to allow users to change their color preferences based on a field value (sender name) and see if it can be done for your case.
Or, have them either access the view via a browser client or XPages in the Notes client and assign a class to that dependent on the severity.
You could build the category column formula with HTML such that when it is severe the value is "<tr class='severe'><td>CategoryNameValueHere</td></tr>" or something along those lines, right?
Using the variables extension, I want to change the background color of a cell in a table. So far I've done this:
{{#vardefine:green|<span style="background:Green; color:White">text</span>}}
The problem is that, when I add {{#var:green}} to the cell, only the text itself has a green background. Ideally, I want the whole cell to have a background color, like it does if I use this:
| bgcolor="#ff00ff" | test
or this
| style="background:silver" |silver
in the cell.
Does anyone know how to solve this?
The answer was provided on the mwusers forum.
Essentially I need to:
Create Template:! - which contains only | (see it on Wikipedia)
Define the variables, e.g.:
{{#vardefine: sample1 | bgcolor=green{{!}}Test}}
Enter this in a cell:
{{#var:sample1}}
That's simply not going to work. I presume your table row looks like this:
| Not in span {{#var:green|Text}}
That means you're defining a span within the cell, not defining the color of the cell itself.
| Not in span <span style="background:Green; color:White">Text</span>
Cell styles have to go before the content:
| bgcolor="green" | Now it's all green
Instead, why not tag the row with a CSS class called 'green' and then define that in your Wiki CSS? See Help:Table#Style classes.