@json-to-office/core-docx 0.1.0 → 0.1.1

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.
@@ -1333,7 +1333,6 @@ var init_styles = __esm({
1333
1333
  // src/utils/widthUtils.ts
1334
1334
  var widthUtils_exports = {};
1335
1335
  __export(widthUtils_exports, {
1336
- __widthUtils: () => __widthUtils,
1337
1336
  getAvailableHeightTwips: () => getAvailableHeightTwips,
1338
1337
  getAvailableWidthTwips: () => getAvailableWidthTwips,
1339
1338
  getPageHeightTwips: () => getPageHeightTwips,
@@ -1378,13 +1377,11 @@ function relativeLengthToTwips(value, availableWidthTwips) {
1378
1377
  if (fraction === void 0) return 0;
1379
1378
  return Math.round(availableWidthTwips * fraction);
1380
1379
  }
1381
- var __widthUtils;
1382
1380
  var init_widthUtils = __esm({
1383
1381
  "src/utils/widthUtils.ts"() {
1384
1382
  "use strict";
1385
1383
  init_styles();
1386
1384
  init_styleHelpers();
1387
- __widthUtils = true;
1388
1385
  }
1389
1386
  });
1390
1387
 
@@ -5070,15 +5067,21 @@ async function createTable(columns, tableConfig, theme, themeName, _options = {}
5070
5067
  let columnWidths;
5071
5068
  let tableWidth;
5072
5069
  if (hasExplicitWidths) {
5073
- const { getAvailableWidthTwips: getAvailableWidthTwips2 } = await Promise.resolve().then(() => (init_widthUtils(), widthUtils_exports));
5070
+ const widthUtils = await Promise.resolve().then(() => (init_widthUtils(), widthUtils_exports));
5071
+ const { getAvailableWidthTwips: getAvailableWidthTwips2, relativeLengthToTwips: relativeLengthToTwips2 } = widthUtils;
5074
5072
  const availableTableWidth = getAvailableWidthTwips2(theme, themeName);
5075
5073
  const columnsWithExplicitWidthTwips = columns.map(
5076
- (col) => col.width !== void 0 ? pointsToTwips(col.width) : void 0
5074
+ (col) => col.width !== void 0 ? relativeLengthToTwips2(col.width, availableTableWidth) : void 0
5077
5075
  );
5078
5076
  const totalExplicitWidth = columnsWithExplicitWidthTwips.reduce(
5079
5077
  (sum, w) => sum + (w || 0),
5080
5078
  0
5081
5079
  );
5080
+ if (totalExplicitWidth > availableTableWidth) {
5081
+ console.warn(
5082
+ `[json-to-office] Column widths total (${totalExplicitWidth} twips) exceeds available table width (${availableTableWidth} twips). Table may overflow.`
5083
+ );
5084
+ }
5082
5085
  const columnsWithoutWidth = columns.filter(
5083
5086
  (col) => col.width === void 0
5084
5087
  ).length;