I think you have a misunderstanding of GetProps() and SetProps(), which is the foundation of your trouble. When you do this:
var testProp = cell.CellOverrideShading.GetProps()
... you are getting the properties of the color object assigned to the CellOverrideShading property, not the cell. And, in this case, the CellOverrideShading property just happens to be an object, otherwise the GetProps() method would not be valid at all. Anyway, a color object has no FP_Color property, hence the reason that you can't find it in the PropVals array.
You could do it with the cell properties directly, maybe something like this (note - I didn't test this!):
var testProps = cell.GetProps();
var testPropIndex = GetPropIndex(testProps, Constants.FP_CellOverrideShading);
...then more code to manipulate the array and reset the properties. However, I would recommend this direct approach instead (again, I didn't test this!):
var colorObj = doc.GetNamedColor("Olive");
if(colorObj.ObjectValid()) cell.CellOverrideShading = colorObj;
I hope this helps some.
Hi Russ, I'm trying to achieve the same thing but am having a little trouble.
// Get the table cell that contains the paragraph.
var cell = pgf.InTextObj; (alert returns a cell object)
cell.CellUseOverrideShading = true ;
cell.CellUseOverrideFill = true ;
cell.CellOverrideFill = 15 ;
var colorObj = doc.GetNamedColor("Red");
cell.CellOverrideShading = colorObj;
Expect to see red cells in my table but am not, any idea what I'm missing?
Hi Tracey, This works for me. I used 0 instead of 15. Make sure you refresh the screen after you run the code.
#target framemaker var doc = app.ActiveDoc; var pgf = doc.TextSelection.beg.obj; var cell = pgf.InTextObj; // Get the Red color object. var color = doc.GetNamedColor ("Red"); // Set the cell's properties to 100% Red. cell.CellOverrideShading = color; cell.CellUseOverrideShading = true; cell.CellOverrideFill = 0; cell.CellUseOverrideFill = true;
Rick is correct. The CellOverrideFill property indicates the fill pattern and it is specified as a constant from 0-15, where 15 is effectively no pattern. Hence why you were seeing nothing happen. Here is a figure from the FDK manual that describes the constants, with a convenient reference to the FM GUI: