@json-to-office/core-docx 0.14.0 → 0.15.0

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.
@@ -850,12 +850,20 @@ function getPageDimensions(size) {
850
850
  }
851
851
  return size;
852
852
  }
853
- var PAGE_SIZES, getTableStyle, getDocumentMargins, getPageSetup;
853
+ var resolveTableParagraphSpacing, PAGE_SIZES, getTableStyle, getDocumentMargins, getPageSetup;
854
854
  var init_layoutUtils = __esm({
855
855
  "src/styles/utils/layoutUtils.ts"() {
856
856
  "use strict";
857
857
  init_colorUtils();
858
858
  init_styleHelpers();
859
+ resolveTableParagraphSpacing = (style) => {
860
+ const lineSpacing = convertLineSpacing(style?.lineSpacing) ?? convertLineSpacing({ type: "single" });
861
+ return {
862
+ before: style?.spacing?.before !== void 0 ? pointsToTwips(style.spacing.before) : 0,
863
+ after: style?.spacing?.after !== void 0 ? pointsToTwips(style.spacing.after) : 0,
864
+ ...lineSpacing
865
+ };
866
+ };
859
867
  PAGE_SIZES = {
860
868
  A4: { width: 11906, height: 16838 },
861
869
  A3: { width: 16838, height: 23811 },
@@ -866,7 +874,10 @@ var init_layoutUtils = __esm({
866
874
  const themeConfig = resolveTheme(theme, themeName);
867
875
  if (themeConfig && themeConfig.styles?.normal) {
868
876
  const normalStyle = themeConfig.styles.normal;
877
+ const styles = themeConfig.styles;
869
878
  return {
879
+ cellParagraph: resolveTableParagraphSpacing(styles.tableCell),
880
+ headerParagraph: resolveTableParagraphSpacing(styles.tableHeader),
870
881
  tableHeader: {
871
882
  fill: resolveColor(
872
883
  themeConfig.colors?.primary || "#000000",
@@ -932,6 +943,8 @@ var init_layoutUtils = __esm({
932
943
  };
933
944
  }
934
945
  return {
946
+ cellParagraph: resolveTableParagraphSpacing(),
947
+ headerParagraph: resolveTableParagraphSpacing(),
935
948
  tableHeader: {
936
949
  fill: "000000",
937
950
  color: "FFFFFF",
@@ -5169,6 +5182,7 @@ async function createTable(columns, tableConfig, theme, themeName, _options = {}
5169
5182
  children: [
5170
5183
  new Paragraph({
5171
5184
  ...tableConfig.keepInOnePage && { keepNext: true },
5185
+ spacing: tableStyle.headerParagraph,
5172
5186
  alignment: getAlignment(horizontalAlignment),
5173
5187
  children: cellChildren
5174
5188
  })
@@ -5263,6 +5277,7 @@ async function createTable(columns, tableConfig, theme, themeName, _options = {}
5263
5277
  children: [
5264
5278
  new Paragraph({
5265
5279
  ...tableConfig.keepInOnePage && !isLastRow || isLastRow && tableConfig.keepNext ? { keepNext: true } : {},
5280
+ spacing: tableStyle.cellParagraph,
5266
5281
  alignment: AlignmentType2.LEFT,
5267
5282
  children: []
5268
5283
  })
@@ -5338,6 +5353,7 @@ async function createTable(columns, tableConfig, theme, themeName, _options = {}
5338
5353
  children: [
5339
5354
  new Paragraph({
5340
5355
  ...tableConfig.keepInOnePage && !isLastRow || isLastRow && tableConfig.keepNext ? { keepNext: true } : {},
5356
+ spacing: tableStyle.cellParagraph,
5341
5357
  alignment: getAlignment(horizontalAlignment),
5342
5358
  children: cellChildren
5343
5359
  })