TinyButStrong - the PHP Template Engine
Categories > OpenTBS with XLSX >

Checkbox in XLSX

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs

By: Fred M
Date: 2015-12-02
Time: 15:51

Checkbox in XLSX

Hi,

I need to check/uncheck checkboxes (Form Control) in some XLSX templates I received from providers (I can't change them to ActiveX Control then).
Is there a way to do this ?
By: Skrol29
Date: 2015-12-05
Time: 23:25

Re: Checkbox in XLSX

Hi,

There is no OpenTBS feature that can do it automatically. But since you understand how are stored Form Controls in an XLSX, you can manage it with code.

In XLSX, the properties of the Form Controls are stored in sub-files such as « xl/ctrlProps/ctrlProp1.xml ».
There is one sub-file for each control in the workbook.
The checked state is done with the attribute « checked="Checked" ».

Checked checkbox:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<formControlPr xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" objectType="CheckBox" checked="Checked" lockText="1" noThreeD="1"/>

Unchecked checkbox:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<formControlPr xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" objectType="CheckBox" lockText="1" noThreeD="1"/>

So your have to load the sub-file corresponding to your checkbox and edit this attribute.