Merge pull request 'fix/bu-bugs' (#1811) from fix/bu-bugs into release/v9.3.0

This commit is contained in:
Ilya Kirillov
2026-01-13 12:45:30 +00:00
4 changed files with 125 additions and 7 deletions

View File

@ -0,0 +1,60 @@
/*
* (c) Copyright Ascensio System SIA 2010-2025
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at 20A-6 Ernesta Birznieka-Upish
* street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
$(function () {
QUnit.module('Test the ApiSection methods');
QUnit.test('GetColumnsCount, GetColumnsSpaces, GetColumnsWidths', function(assert)
{
let document = AscTest.JsApi.GetDocument();
section = document.GetFinalSection();
let widths = [1440, 2880, 4320];
let spaces = [720, 480];
section.SetNotEqualColumns(widths, spaces);
let checkWidths = section.GetColumnsWidths();
let checkSpaces = section.GetColumnsSpaces();
assert.strictEqual(section.GetColumnsCount(), 3, 'Columns count should be 3');
widths.forEach((width, idx) => {
assert.strictEqual(width, checkWidths[idx], `The set width with idx = ${idx} differs from the received one`);
});
spaces.forEach((space, idx) => {
assert.strictEqual(space, checkSpaces[idx], `The set space with idx = ${idx} differs from the received one`);
});
});
});

View File

@ -32,6 +32,7 @@
<script type="text/javascript" src="api-range.js"></script>
<script type="text/javascript" src="api-run.js"></script>
<script type="text/javascript" src="api-table-cell.js"></script>
<script type="text/javascript" src="api-section.js"></script>
</head>
<body>
<h1 id="qunit-header">Test document js-api</h1>

View File

@ -12952,6 +12952,63 @@
this.Section.Set_Columns_Num(aCols.length);
return true;
};
/**
* Returns number of columns in this section.
* @memberof ApiSection
* @typeofeditors ["CDE"]
* @returns {number}
* @see office-js-api/Examples/{Editor}/ApiSection/Methods/GetColumnsCount.js
*/
ApiSection.prototype.GetColumnsCount = function()
{
return this.Section.GetColumnCount();
};
/**
* Returns an array of column width values measured in twentieths of a point (1/1440 of an inch).
* @memberof ApiSection
* @typeofeditors ["CDE"]
* @returns {twips[]}
* @see office-js-api/Examples/{Editor}/ApiSection/Methods/GetColumnsWidths.js
*/
ApiSection.prototype.GetColumnsWidths = function()
{
if (this.Section.IsEqualColumnWidth()) {
return [private_MM2Twips(this.Section.GetColumnWidth())];
}
else
{
let nCols = this.GetColumnsCount();
let aRes = [];
for (let i = 0; i < nCols; i++)
aRes.push(private_MM2Twips(this.Section.GetColumnWidth(i)));
return aRes;
}
};
/**
* Returns an array of distance values between the columns measured in twentieths of a point (1/1440 of an inch).
* @memberof ApiSection
* @typeofeditors ["CDE"]
* @returns {twips[]}
* @see office-js-api/Examples/{Editor}/ApiSection/Methods/GetColumnsSpaces.js
*/
ApiSection.prototype.GetColumnsSpaces = function()
{
if (this.Section.IsEqualColumnWidth()) {
return [private_MM2Twips(this.Section.GetColumnSpace())];
}
else
{
let nCols = this.GetColumnsCount();
let aRes = [];
for (let i = 0; i < nCols - 1; i++)
aRes.push(private_MM2Twips(this.Section.GetColumnSpace(i)));
return aRes;
}
};
/**
* Specifies the properties (size and orientation) for all the pages in the current section.
* @memberof ApiSection
@ -17060,7 +17117,7 @@
* Sets the outline level for the specified properties.
* @memberof ApiParaPr
* @typeofeditors ["CDE", "CSE", "CPE"]
* @param {Number?} [nLvl=undefined] - The outline level. Possible values: 0-8. The 0 value means the basic outline level.
* @param {Number?} [nLvl=undefined] - The outline level. Possible values: 1-9. The 1The desired functionality is as follows: When inserting document A into document B using the merge document API during editing, the source of document A should be visible within document B. By clicking or hovering over the inserted content of document A in document B, information about the insertion of document A should be displayed in a pop-up/floating window, preserving the boundaries of document A. Document A should be able to be inserted between any two characters in document B.
* To set no outline level, use this method without a parameter.
* @returns {boolean}
* @since 8.2.0
@ -17070,7 +17127,7 @@
{
if (typeof(nLvl) === "number") {
nLvl = Math.ceil(nLvl);
if (nLvl < 0 || nLvl > 8) {
if (nLvl < 1 || nLvl > 9) {
return false;
}
}
@ -17078,7 +17135,7 @@
return false;
}
this.ParaPr.OutlineLvl = nLvl;
this.ParaPr.OutlineLvl = typeof(nLvl) === "number" ? nLvl - 1 : nLvl;
this.private_OnChange();
};
@ -17092,7 +17149,7 @@
*/
ApiParaPr.prototype.GetOutlineLvl = function()
{
return this.ParaPr.OutlineLvl;
return typeof(this.ParaPr.OutlineLvl) == "number" ? this.ParaPr.OutlineLvl + 1 : this.ParaPr.OutlineLvl;
};
/**

View File

@ -7968,7 +7968,7 @@
var oTempElm = null;
var arrContent = [];
if (oMathContent instanceof AscCommonWord.CDenominator || oMathContent instanceof AscCommonWord.CNumerator)
if (oMathContent instanceof CDenominator || oMathContent instanceof CNumerator)
arrContent.push(SerFracArg.call(this, oMathContent));
else
{
@ -8052,9 +8052,9 @@
return oFractionArg;
var sArgType = "";
if (oFractionArg instanceof AscCommonWord.CDenominator)
if (oFractionArg instanceof CDenominator)
sArgType = "den";
else if (oFractionArg instanceof AscCommonWord.CNumerator)
else if (oFractionArg instanceof CNumerator)
sArgType = "num";
return {