rapid-spreadjs 1.0.124 → 1.0.126

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -827,12 +827,14 @@ const BusinessUtils = {
827
827
  * @param addRowIndex 添加检测对象属性区域的起始行索引,默认为:0
828
828
  * @param deleteRowsCount 删除的行数,默认为:0
829
829
  * @param isVertical 是否为纵表,默认为:true
830
+ * @param valueAlign 值单元格对齐方式,默认为:left
831
+ * @param valuePaddingLeft 值单元格的左边距,默认为:0(单位为像素)
830
832
  * @param contentColStartIndex 表格内容列起始索引,默认为:1
831
833
  * @param contentTotalColCount 表格内容列总数,默认为:77
832
834
  * @param addRowHeight 添加的表格行高,默认为:24(单位为像素)
833
835
  * @returns 返回生成的检测对象属性行数
834
836
  */
835
- createTestObjectAttrsCells: (gc, sheet, testObjectAttrs, addRowIndex = 0, deleteRowsCount = 0, isVertical = true, contentColStartIndex = 1, contentTotalColCount = 77, addRowHeight = 24) => {
837
+ createTestObjectAttrsCells: (gc, sheet, testObjectAttrs, addRowIndex = 0, deleteRowsCount = 0, isVertical = true, valueAlign = 'left', valuePaddingLeft = 0, contentColStartIndex = 1, contentTotalColCount = 77, addRowHeight = 24) => {
836
838
  if (!testObjectAttrs || testObjectAttrs.length === 0) {
837
839
  return;
838
840
  }
@@ -860,10 +862,21 @@ const BusinessUtils = {
860
862
  * 设置单元格字体和大小
861
863
  * @param row
862
864
  * @param col
865
+ * @param isValueCell 是否为值单元格,默认为:false
863
866
  */
864
- const setFontSizeFamily = (row, col) => {
865
- sheet.getCell(row, col).fontFamily('宋体');
866
- sheet.getCell(row, col).fontSize('9pt');
867
+ const setFontSizeFamily = (row, col, isValueCell = false) => {
868
+ const cellObj = sheet.getCell(row, col);
869
+ cellObj.fontFamily('宋体').fontSize('9pt').cellPadding(`0 0 0 ${valuePaddingLeft}`);
870
+ // 值单元格的时候,居左显示
871
+ if (isValueCell) {
872
+ cellObj.hAlign(valueAlign == 'left'
873
+ ? gc.Spread.Sheets.HorizontalAlign.left
874
+ : valueAlign == 'center'
875
+ ? gc.Spread.Sheets.HorizontalAlign.center
876
+ : valueAlign == 'right'
877
+ ? gc.Spread.Sheets.HorizontalAlign.right
878
+ : gc.Spread.Sheets.HorizontalAlign.left);
879
+ }
867
880
  };
868
881
  for (let i = 0; i < testObjectAttrsChunk.length; i++) {
869
882
  const rowAttrArr = testObjectAttrsChunk[i];
@@ -881,7 +894,8 @@ const BusinessUtils = {
881
894
  left: true,
882
895
  right: true,
883
896
  top: i == 0,
884
- bottom: i == testObjectAttrsChunk.length - 1,
897
+ // bottom: i == testObjectAttrsChunk.length - 1
898
+ bottom: false,
885
899
  });
886
900
  // 设置单元格水平和垂直居中
887
901
  addRowRange.hAlign(gc.Spread.Sheets.HorizontalAlign.center);
@@ -892,7 +906,7 @@ const BusinessUtils = {
892
906
  sheet.setValue(totalRowCount, contentColStartIndex, rowAttrArr[0].title);
893
907
  sheet.setValue(totalRowCount, contentColStartIndex + titleCellColumnCount, rowAttrArr[0].value);
894
908
  setFontSizeFamily(totalRowCount, contentColStartIndex);
895
- setFontSizeFamily(totalRowCount, contentColStartIndex + titleCellColumnCount);
909
+ setFontSizeFamily(totalRowCount, contentColStartIndex + titleCellColumnCount, true);
896
910
  // 合并第二个属性的标题列和值列,同时设置对应单元格的内容
897
911
  if (rowAttrArr.length > 1) {
898
912
  const colIndexTitle = contentColStartIndex + titleCellColumnCount + titleCellValColumnCount;
@@ -902,7 +916,7 @@ const BusinessUtils = {
902
916
  sheet.setValue(totalRowCount, colIndexTitle, rowAttrArr[1].title);
903
917
  sheet.setValue(totalRowCount, colIndexValue, rowAttrArr[1].value);
904
918
  setFontSizeFamily(totalRowCount, colIndexTitle);
905
- setFontSizeFamily(totalRowCount, colIndexValue);
919
+ setFontSizeFamily(totalRowCount, colIndexValue, true);
906
920
  }
907
921
  // 合并第三个属性的标题列和值列,同时设置对应单元格的内容
908
922
  if (rowAttrArr.length > 2) {
@@ -913,7 +927,7 @@ const BusinessUtils = {
913
927
  sheet.setValue(totalRowCount, colIndexTitle, rowAttrArr[2].title);
914
928
  sheet.setValue(totalRowCount, colIndexValue, rowAttrArr[2].value);
915
929
  setFontSizeFamily(totalRowCount, colIndexTitle);
916
- setFontSizeFamily(totalRowCount, colIndexValue);
930
+ setFontSizeFamily(totalRowCount, colIndexValue, true);
917
931
  }
918
932
  }
919
933
  // 恢复绘制
@@ -21504,7 +21518,7 @@ const FormulaUtils = {
21504
21518
  if (retData.allCellValsEw.length < 7) {
21505
21519
  return '/';
21506
21520
  }
21507
- const val1 = retData.allCellValsEw[0][0], val2 = retData.allCellValsEw[1][0], val3 = retData.allCellValsEw[2][0], val4 = retData.allCellValsEw[3][0], val5 = retData.allCellValsEw[4][0], val6 = retData.allCellValsEw[5][0], overVal = retData.allCellValsEw[6][0];
21521
+ const val1 = retData.allCellValsEw[0][0], val2 = retData.allCellValsEw[1][0], val3 = retData.allCellValsEw[2][0], val4 = retData.allCellValsEw[3][0], val5 = retData.allCellValsEw[4][0], val6 = retData.allCellValsEw[5][0], overVal = retData.allCellValsEw[6];
21508
21522
  if (typeof overVal !== 'number' || isNaN(overVal)) {
21509
21523
  return '/';
21510
21524
  }