mirror of
https://github.com/optilude/xlsx-template.git
synced 2026-07-02 08:27:39 +08:00
Fixing Defined Range Name with Sheet Name (#150)
* fixing defined range name with sheetname * add test for _xlnm.Print_Titles named range Co-authored-by: Ade Pangestu <ade.pangestu@mitrais.com>
This commit is contained in:
+2
-2
@@ -830,11 +830,11 @@ module.exports = (function() {
|
||||
// Split a reference into an object with keys `row` and `col` and,
|
||||
// optionally, `table`, `rowAbsolute` and `colAbsolute`.
|
||||
Workbook.prototype.splitRef = function(ref) {
|
||||
var match = ref.match(/(?:(.+)!)?(\$)?([A-Z]+)(\$)?([0-9]+)/);
|
||||
var match = ref.match(/(?:(.+)!)?(\$)?([A-Z]+)?(\$)?([0-9]+)/);
|
||||
return {
|
||||
table: match && match[1] || null,
|
||||
colAbsolute: Boolean(match && match[2]),
|
||||
col: match && match[3],
|
||||
col: match && match[3] || "",
|
||||
rowAbsolute: Boolean(match && match[4]),
|
||||
row: parseInt(match && match[5], 10)
|
||||
};
|
||||
|
||||
@@ -667,6 +667,7 @@ describe("CRUD operations", function() {
|
||||
expect(workbook.find("./definedNames/definedName[@name='RangeBelowTable']").text).toEqual("Tables!$B$19:$C$19");
|
||||
expect(workbook.find("./definedNames/definedName[@name='RangeRightOfTable']").text).toEqual("Tables!$E$14:$F$14");
|
||||
expect(workbook.find("./definedNames/definedName[@name='RightOfTable']").text).toEqual("Tables!$F$8");
|
||||
expect(workbook.find("./definedNames/definedName[@name='_xlnm.Print_Titles']").text).toEqual("Tables!$1:$3");
|
||||
|
||||
// Merged cells have moved
|
||||
expect(sheet1.find("./mergeCells/mergeCell[@ref='B2:C2']")).not.toBeNull(); // title - unchanged
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user