Set comment for a range

Hi Folks,


Is it possible to do the above with the FlexCel API?

Regards

-Mohamed

Hi,
I am not sure on what you refer to with setting a comment for a range? If it is setting a comment of r range of cells, a comment is always attached to a single cell. What you can do is to loop in the range and add the same comment for each cell, but I am not sure this is what you want to do.

If the idea is to add a comment to a named range, yes, you can do that and APIMate should show you how. Code like this should work:


            TXlsNamedRange nm = new TXlsNamedRange("MyName", 0, 1, 1, 1, 10, 10, 0);
            nm.Comment = "my comment";
            xls.SetNamedRange(nm);



Thanks Adrian!


I am really looking to find a workaround for a usability problem.

We generate worksheets which use datavalidations for each column.

Currently, we display a hint to the user explaining the permitted range of values by setting the ShowInputBox property to true.

Some of our users have complained that the resulting yellow box is both distracting and intrusive i.e. that it gets in the way.

I am trying to think of another way of displaying the same information but only when the user wants to see it and figured that a comment would be the best solution.

The reason I need to set it for a range i.e. the column is so that this information is available on inserted rows.

Regards

-Mohamed

Ah, ok. Sadly a comment is attached to a single cell in Excel, there is no way to add a comment for a column. But what if you just disable the ShowInputBox but enable ShowErrorBox? This way if the user enters a valid value there won't be any disruption, but if he tries to enter an invalid value, you can show him a dialog telling him the valid values and the reason it is invalid. Seems like the best solution for your case.

Hi Adrian,


I think your solution is the best approach for my case.

Unfortunately, I regret to inform you that there may be a problem with release 6..9.0.0.

I upgraded to this new release and now when I try to modify any value in a generated worksheet, I get a message to the effect that the cell is protected.

Regards

-Mohamed

Hi,
This is weird, we didn't change anything in the code for protected cells. Can you email me the files before and after modification to adrian@tmssoftware.com ?  Or any simple app that shows the problem so we can investigate it.

Done.


Reverting to the 6.7.1.0 version of the FlexCel assembly made this problem go away.

Regards

-Mohamed

Hi,
Thanks for the files, I got them. But as commented via direct mail, both files are identical excpept for the data validation input box, and neither allow me to modify values here, as the cells are locked.

I've sent you an email with more information. But can you try unlocking the cells where you want the user to be able to edit values?

As discussed, this was a false alarm due to my use of the wrong FlexCel assembly.


Regards

-Mohamed