updated SetDefinedName's localSheetId attr to use sheetIndex

Excelize 2.3.2 OUT:

```
<sheets>
        <sheet name="Q-P-QP-11" sheetId="55" r:id="rId1"/>
        <sheet name="Q-P-QP-12" sheetId="53" r:id="rId2"/>
        <sheet name="Q-P-QP-13" sheetId="54" r:id="rId3"/>
        <sheet name="Q-P-RN-12" sheetId="56" r:id="rId4"/>
        <sheet name="Q-P-RN-13" sheetId="57" r:id="rId5"/>
        <sheet name="C-C-QP-11-12-13-RN-12-13" sheetId="50" r:id="rId6"/>
        <sheet name="E-T-QP-11-12-13" sheetId="31" r:id="rId7"/>
        <sheet name="E-T-BK" sheetId="60" r:id="rId8"/>
        <sheet name="E-A-RN-12-13" sheetId="43" r:id="rId9"/>
        <sheet name="F1-A-QP-11-12-13" sheetId="1" r:id="rId10"/>
        <sheet name="F2-A-QP-11-12-13" sheetId="23" r:id="rId11"/>
        <sheet name="C-A-QP-12-13-RN-12-13" sheetId="48" r:id="rId12"/>
        <sheet name="C-T-QP-12-13" sheetId="7" r:id="rId13"/>
        <sheet name="R-T-QP-12-RN-12-13" sheetId="45" r:id="rId14"/>
        <sheet name="C-T-QP-11" sheetId="58" r:id="rId15"/>
        <sheet name="R-T-QP-11" sheetId="3" r:id="rId16"/>
        <sheet name="A-T-QP-11-12-RN-12" sheetId="13" r:id="rId17"/>
        <sheet name="A2-T-RN-13" sheetId="42" r:id="rId18"/>
        <sheet name="ap-T-QP-11" sheetId="59" r:id="rId19"/>
        <sheet name="B-A-QP-12-13" sheetId="32" r:id="rId20"/>
        <sheet name="B-A-QP-11" sheetId="33" r:id="rId21"/>
    </sheets>
    <definedNames>
        <definedName localSheetId="58" name="_xlnm.Print_Titles">ap-T-QP-11!$2:$5</definedName>
        <definedName localSheetId="2" name="_xlnm.Print_Titles">R-T-QP-11!$2:$13</definedName>
    </definedNames>
```

MS Excel 2010 out

```
<sheets>
        <sheet name="Q-P-QP-11" sheetId="55" r:id="rId1"/>
        <sheet name="Q-P-QP-12" sheetId="53" r:id="rId2"/>
        <sheet name="Q-P-QP-13" sheetId="54" r:id="rId3"/>
        <sheet name="Q-P-RN-12" sheetId="56" r:id="rId4"/>
        <sheet name="Q-P-RN-13" sheetId="57" r:id="rId5"/>
        <sheet name="C-C-QP-11-12-13-RN-12-13" sheetId="50" r:id="rId6"/>
        <sheet name="E-T-QP-11-12-13" sheetId="31" r:id="rId7"/>
        <sheet name="E-T-BK" sheetId="60" r:id="rId8"/>
        <sheet name="E-A-RN-12-13" sheetId="43" r:id="rId9"/>
        <sheet name="F1-A-QP-11-12-13" sheetId="1" r:id="rId10"/>
        <sheet name="F2-A-QP-11-12-13" sheetId="23" r:id="rId11"/>
        <sheet name="C-A-QP-12-13-RN-12-13" sheetId="48" r:id="rId12"/>
        <sheet name="C-T-QP-12-13" sheetId="7" r:id="rId13"/>
        <sheet name="R-T-QP-12-RN-12-13" sheetId="45" r:id="rId14"/>
        <sheet name="C-T-QP-11" sheetId="58" r:id="rId15"/>
        <sheet name="R-T-QP-11" sheetId="3" r:id="rId16"/>
        <sheet name="A-T-QP-11-12-RN-12" sheetId="13" r:id="rId17"/>
        <sheet name="A2-T-RN-13" sheetId="42" r:id="rId18"/>
        <sheet name="ap-T-QP-11" sheetId="59" r:id="rId19"/>
        <sheet name="B-A-QP-12-13" sheetId="32" r:id="rId20"/>
        <sheet name="B-A-QP-11" sheetId="33" r:id="rId21"/>
    </sheets>
    <definedNames>
        <definedName name="_xlnm.Print_Titles" localSheetId="18">'ap-T-QP-11'!$2:$5</definedName>
        <definedName name="_xlnm.Print_Titles" localSheetId="15">'R-T-QP-11'!$2:$13</definedName>
    </definedNames>
```


Compare localSheetId it uses sheet index instead of sheet's sheetId
This commit is contained in:
David 2021-03-21 19:39:36 -04:00 committed by GitHub
parent 874d59cee0
commit d08a6d2437
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -1487,9 +1487,8 @@ func (f *File) SetDefinedName(definedName *DefinedName) error {
Data: definedName.RefersTo,
}
if definedName.Scope != "" {
if sheetID := f.getSheetID(definedName.Scope); sheetID != 0 {
sheetID--
d.LocalSheetID = &sheetID
if sheetIndex := f.GetSheetIndex(definedName.Scope); sheetIndex >= 0 {
d.LocalSheetID = &sheetIndex
}
}
if wb.DefinedNames != nil {