This closes #2113, AddFormControl function support set cell link for check box
This commit is contained in:
parent
6007d25231
commit
f85dae6cfa
9
vml.go
9
vml.go
|
@ -372,7 +372,11 @@ func (f *File) commentsWriter() {
|
|||
// by given worksheet name and form control options. Supported form control
|
||||
// type: button, check box, group box, label, option button, scroll bar and
|
||||
// spinner. If set macro for the form control, the workbook extension should be
|
||||
// XLSM or XLTM. Scroll value must be between 0 and 30000.
|
||||
// XLSM or XLTM. Scroll value must be between 0 and 30000. Please note that if a
|
||||
// cell link is set for a checkbox form control, Excelize will not assign a
|
||||
// value to the linked cell when the checkbox is checked. To reflect the
|
||||
// checkbox state, please use the 'SetCellValue' function to manually set the
|
||||
// linked cell's value to true.
|
||||
//
|
||||
// Example 1, add button form control with macro, rich-text, custom button size,
|
||||
// print property on Sheet1!A2, and let the button do not move or size with
|
||||
|
@ -826,6 +830,9 @@ func (f *File) addFormCtrlShape(preset formCtrlPreset, col, row int, anchor stri
|
|||
if (opts.Type == FormControlCheckBox || opts.Type == FormControlOptionButton) && opts.Checked {
|
||||
sp.ClientData.Checked = 1
|
||||
}
|
||||
if opts.FormControl.Type == FormControlCheckBox {
|
||||
sp.ClientData.FmlaLink = opts.CellLink
|
||||
}
|
||||
return &sp, sp.addFormCtrl(opts)
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ func TestFormControl(t *testing.T) {
|
|||
},
|
||||
{
|
||||
Cell: "A6", Type: FormControlCheckBox, Text: "Check Box 2",
|
||||
Format: GraphicOptions{Positioning: "twoCell"},
|
||||
CellLink: "C5", Format: GraphicOptions{Positioning: "twoCell"},
|
||||
},
|
||||
{
|
||||
Cell: "A7", Type: FormControlOptionButton, Text: "Option Button 1", Checked: true,
|
||||
|
|
Loading…
Reference in New Issue