HELP: Visio automated colors

Started by Aliq, June 01, 2011, 11:12:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Jumpy

Could you post a littel example of your drawing, a few shapes, as to see their internal structure, but with non sensitive data?

Aliq

Quote from: Jumpy on June 08, 2011, 06:45:50 AM
Could you post a littel example of your drawing, a few shapes, as to see their internal structure, but with non sensitive data?

Alright, it's not sensitive data at all, as I didn't use the real Excel sheet.
This one was made with Visio's wizard and is a test file.


Visio Guy

Your shapes don't have "Prop.Job", they have "Prop.Functieomschrijving" or "Prop.Title", not sure if you want the title or the funktionsbeschreibung to determine the colors.

You query the shape by asking for the value of the cell named in the argument:

val = shp.Cells("somecellname").ResultStr(Vis.visUnitCodes.visUnitsString)

then you check val to determine which color to apply.
For articles, tips and free content, see the Visio Guy Website at http://www.visguy.com
Get my Visio Book! Using Microsoft Visio 2010

Aliq

Quote from: Visio Guy on June 08, 2011, 09:42:49 AM
Your shapes don't have "Prop.Job", they have "Prop.Functieomschrijving" or "Prop.Title", not sure if you want the title or the funktionsbeschreibung to determine the colors.

You query the shape by asking for the value of the cell named in the argument:

val = shp.Cells("somecellname").ResultStr(Vis.visUnitCodes.visUnitsString)

then you check val to determine which color to apply.

Haha, first of all nice dutch + german ;)
I need it through the Prop.Functieomschrijving, which is Prop.Job

Aliq

Jumpy

Than this should be the little change you need to make in the code.


.
.
.
If shp.CellExists("Prop.Functieomschrijving",false) then

    Select Case shp.Cells("Prop.Functieomschrijving").ResultStr("")
.
.
.

Aliq

Quote from: Jumpy on June 08, 2011, 12:29:06 PM
Than this should be the little change you need to make in the code.


.
.
.
If shp.CellExists("Prop.Functieomschrijving",false) then

    Select Case shp.Cells("Prop.Functieomschrijving").ResultStr("")
.
.
.


Ok it works, thanks allot mate!
I can just add cases underneath the one case right?
And I can change the "LineColor" to "FillBkgrnd" << not sure but I read it somewhere gonna search for it.

Aliq

Jumpy

Yes and Yes, but I think FillBkgnd without "r". Or FillForegnd.
I never remember what's to use, because one is only used with FillPatterns.

Aliq

Quote from: Jumpy on June 08, 2011, 02:49:55 PM
Yes and Yes, but I think FillBkgnd without "r". Or FillForegnd.
I never remember what's to use, because one is only used with FillPatterns.

Thanks allot everyone, specially Jumpy!
Now to get some buttons and stuff working, might need help and see me post something else, haha.

Aliq

Jumpy

Don't know from where in Orange Oranje County  you hale, but as live near Venlo, you can see it as neighborly help  ;D

georgejost

#24
Quote from: Visio Guy on June 08, 2011, 09:42:49 AM
Your shapes don't have "Prop.Job", they have "Prop.Functieomschrijving" or "Prop.Title", not sure if you want the title or the funktionsbeschreibung to determine the colors.

You query the shape by asking for the value of the cell named in the argument:

val = shp.Cells("somecellname").ResultStr(Vis.visUnitCodes.visUnitsString)

then you check val to determine which color to apply.

How do you get the EXACT cell names?

I've been trying, (sorry this is in C++) but nothing happens (note I tried get_CellsU) as well.

         CVCell backgroundCell = next.get_Cells("FillBkgnd");
         backgroundCell.put_Formula(child->m_color == CASSTVisioIF::eWhiteColor
            ? CASSTVisioIF::m_SupportedColorFormulaWhite
            : CASSTVisioIF::m_SupportedColorFormulaGray);

I was looking at the MSDN reference and it doesn't help alot but it called the cell "FillBkgnd"), here :

https://msdn.microsoft.com/en-us/library/office/jj945060.aspx?f=255&MSPPError=-2147217396

/* So far, in my 20 years of s/w experience, this is the most difficult API I've ever used. Part of the problem
    involves the lack of documentation.
*/

Yacine

I'm not that much in C#, but in VBA shp.cells(CellName) always works.
I do get the name by opening the shapesheet of a shape, then edit a random cell (eg one in the user section), while in edit mode (F2), I click on the aimed cell. Visio inserts the cell's name in the cell being edited.

HTH,
Y.
Yacine

Surrogate


georgejost

Quote from: Yacine on February 10, 2016, 08:41:56 PM
I'm not that much in C#, but in VBA shp.cells(CellName) always works.
I do get the name by opening the shapesheet of a shape, then edit a random cell (eg one in the user section), while in edit mode (F2), I click on the aimed cell. Visio inserts the cell's name in the cell being edited.

HTH,
Y.

Quote from: Surrogate on February 10, 2016, 08:48:31 PM
Fill Format section cells

thanks

I discovered that the shape I was using, 3D rectangle was not using these attributes. however, fill fore color worked for
Rectangle and rounded rectangle. I guess the former is using shading. y
The line color worked on the latter shapes  but not the former

Anyway, found that by trial and error. look forward to playing more in GUI to try your tips