|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Regarding Data ValidationHi,
I am writing a small application in OpenOffice calc using Basic programming. There is a need to construct a list of valid strings based on current settings in one cell and enable data validation of another cell using this list of strings. I am facing two level difficulties 1.) I can't completely figure out what APIs would be used for this purpose. I have reffered to XPropertySet, XSheetCondition, TableValidation, SheetCell for this purose. 2.) I can find some documentation on how to specify a numeric condition but I am failing to find help on how to specify list of valid strings. 3.) I can't get this code to work oCell.Validation.setPropertyValue("Type", com.sun.star.sheet.ValidationType.DECIMAL) oCell.Validation.setPropertyValue("IgnoreBlankCells",1) oCell.Validation.setPropertyValue("InputTitle","Width Distribution") xPropertySetInfo = oCell.Validation.getPropertySetInfo() MsgBox oCell.Validation.getPropertyValue("Type") The last syntax always returns 0, whether I use DECIMAL or LIST. Infact I printed the value of DECIMAL constant and found out it is "2". Please help me figure out what am I doing wrong and what all am I missing ? -- Regards Madhur Kashyap |
|
|
Re: Regarding Data ValidationOn 10/14/09 11:05, Madhur Kashyap wrote:
> I am writing a small application in OpenOffice calc using Basic programming. > There is a need to construct a list of valid strings based on current > settings in one cell and enable data validation of another cell using this > list of strings. > > I am facing two level difficulties > > 1.) I can't completely figure out what APIs would be used for this purpose. > I have reffered to XPropertySet, XSheetCondition, TableValidation, SheetCell > for this purose. It's described at http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Other_Table_Operations. > 2.) I can find some documentation on how to specify a numeric condition but > I am failing to find help on how to specify list of valid strings. Use a formula like "one";"two";"three". > 3.) I can't get this code to work > > oCell.Validation.setPropertyValue("Type", > com.sun.star.sheet.ValidationType.DECIMAL) > oCell.Validation.setPropertyValue("IgnoreBlankCells",1) > oCell.Validation.setPropertyValue("InputTitle","Width Distribution") > xPropertySetInfo = oCell.Validation.getPropertySetInfo() > MsgBox oCell.Validation.getPropertyValue("Type") > > The last syntax always returns 0, whether I use DECIMAL or LIST. Infact I > printed the value of DECIMAL constant and found out it is "2". > > Please help me figure out what am I doing wrong and what all am I missing ? The validation object just stores the settings. To apply them, you have to set the "Validation" property again: oValidation = oCell.Validation oValidation.Type = com.sun.star.sheet.ValidationType.LIST oValidation.Operator = com.sun.star.sheet.ConditionOperator.EQUAL oValidation.Formula1 = """one"";""two"";""three""" oCell.Validation = oValidation Niklas --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@... For additional commands, e-mail: dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |