docx-plus 0.1.2 → 0.1.4
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 +266 -11
- package/dist/index.d.cts +12 -2
- package/dist/index.d.mts +12 -2
- package/dist/index.iife.js +266 -11
- package/dist/index.mjs +266 -12
- package/dist/index.umd.js +266 -11
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -12415,7 +12415,8 @@
|
|
|
12415
12415
|
NONE: 0,
|
|
12416
12416
|
SQUARE: 1,
|
|
12417
12417
|
TIGHT: 2,
|
|
12418
|
-
TOP_AND_BOTTOM: 3
|
|
12418
|
+
TOP_AND_BOTTOM: 3,
|
|
12419
|
+
THROUGH: 4
|
|
12419
12420
|
};
|
|
12420
12421
|
/**
|
|
12421
12422
|
* Enumeration of text wrapping sides for floating drawings.
|
|
@@ -12530,10 +12531,101 @@
|
|
|
12530
12531
|
* @module
|
|
12531
12532
|
*/
|
|
12532
12533
|
/**
|
|
12534
|
+
* Creates a default rectangular wrap polygon matching the image extent.
|
|
12535
|
+
*
|
|
12536
|
+
* Reference: http://officeopenxml.com/drwPicFloating-textWrap.php
|
|
12537
|
+
*
|
|
12538
|
+
* ## XSD Schema
|
|
12539
|
+
* ```xml
|
|
12540
|
+
* <xsd:complexType name="CT_WrapPath">
|
|
12541
|
+
* <xsd:sequence>
|
|
12542
|
+
* <xsd:element name="start" type="a:CT_Point2D" minOccurs="1" maxOccurs="1"/>
|
|
12543
|
+
* <xsd:element name="lineTo" type="a:CT_Point2D" minOccurs="2" maxOccurs="unbounded"/>
|
|
12544
|
+
* </xsd:sequence>
|
|
12545
|
+
* <xsd:attribute name="edited" type="xsd:boolean" use="optional"/>
|
|
12546
|
+
* </xsd:complexType>
|
|
12547
|
+
* ```
|
|
12548
|
+
*/
|
|
12549
|
+
const createWrapPolygon$1 = (cx, cy) => new BuilderElement({
|
|
12550
|
+
attributes: { edited: {
|
|
12551
|
+
key: "edited",
|
|
12552
|
+
value: "0"
|
|
12553
|
+
} },
|
|
12554
|
+
children: [
|
|
12555
|
+
new BuilderElement({
|
|
12556
|
+
attributes: {
|
|
12557
|
+
x: {
|
|
12558
|
+
key: "x",
|
|
12559
|
+
value: 0
|
|
12560
|
+
},
|
|
12561
|
+
y: {
|
|
12562
|
+
key: "y",
|
|
12563
|
+
value: 0
|
|
12564
|
+
}
|
|
12565
|
+
},
|
|
12566
|
+
name: "wp:start"
|
|
12567
|
+
}),
|
|
12568
|
+
new BuilderElement({
|
|
12569
|
+
attributes: {
|
|
12570
|
+
x: {
|
|
12571
|
+
key: "x",
|
|
12572
|
+
value: 0
|
|
12573
|
+
},
|
|
12574
|
+
y: {
|
|
12575
|
+
key: "y",
|
|
12576
|
+
value: -cy
|
|
12577
|
+
}
|
|
12578
|
+
},
|
|
12579
|
+
name: "wp:lineTo"
|
|
12580
|
+
}),
|
|
12581
|
+
new BuilderElement({
|
|
12582
|
+
attributes: {
|
|
12583
|
+
x: {
|
|
12584
|
+
key: "x",
|
|
12585
|
+
value: cx
|
|
12586
|
+
},
|
|
12587
|
+
y: {
|
|
12588
|
+
key: "y",
|
|
12589
|
+
value: -cy
|
|
12590
|
+
}
|
|
12591
|
+
},
|
|
12592
|
+
name: "wp:lineTo"
|
|
12593
|
+
}),
|
|
12594
|
+
new BuilderElement({
|
|
12595
|
+
attributes: {
|
|
12596
|
+
x: {
|
|
12597
|
+
key: "x",
|
|
12598
|
+
value: cx
|
|
12599
|
+
},
|
|
12600
|
+
y: {
|
|
12601
|
+
key: "y",
|
|
12602
|
+
value: 0
|
|
12603
|
+
}
|
|
12604
|
+
},
|
|
12605
|
+
name: "wp:lineTo"
|
|
12606
|
+
}),
|
|
12607
|
+
new BuilderElement({
|
|
12608
|
+
attributes: {
|
|
12609
|
+
x: {
|
|
12610
|
+
key: "x",
|
|
12611
|
+
value: 0
|
|
12612
|
+
},
|
|
12613
|
+
y: {
|
|
12614
|
+
key: "y",
|
|
12615
|
+
value: 0
|
|
12616
|
+
}
|
|
12617
|
+
},
|
|
12618
|
+
name: "wp:lineTo"
|
|
12619
|
+
})
|
|
12620
|
+
],
|
|
12621
|
+
name: "wp:wrapPolygon"
|
|
12622
|
+
});
|
|
12623
|
+
/**
|
|
12533
12624
|
* Creates tight text wrapping for a floating drawing.
|
|
12534
12625
|
*
|
|
12535
12626
|
* WrapTight causes text to wrap closely around the contours
|
|
12536
12627
|
* of the drawing rather than its rectangular bounding box.
|
|
12628
|
+
* A default rectangular wrap polygon matching the image extent is generated.
|
|
12537
12629
|
*
|
|
12538
12630
|
* Reference: http://officeopenxml.com/drwPicFloating-textWrap.php
|
|
12539
12631
|
*
|
|
@@ -12541,7 +12633,7 @@
|
|
|
12541
12633
|
* ```xml
|
|
12542
12634
|
* <xsd:complexType name="CT_WrapTight">
|
|
12543
12635
|
* <xsd:sequence>
|
|
12544
|
-
* <xsd:element name="wrapPolygon" type="CT_WrapPath"/>
|
|
12636
|
+
* <xsd:element name="wrapPolygon" type="CT_WrapPath" minOccurs="1" maxOccurs="1"/>
|
|
12545
12637
|
* </xsd:sequence>
|
|
12546
12638
|
* <xsd:attribute name="wrapText" type="ST_WrapText" use="required"/>
|
|
12547
12639
|
* <xsd:attribute name="distL" type="ST_WrapDistance"/>
|
|
@@ -12549,23 +12641,176 @@
|
|
|
12549
12641
|
* </xsd:complexType>
|
|
12550
12642
|
* ```
|
|
12551
12643
|
*/
|
|
12552
|
-
const createWrapTight = (margins = {
|
|
12644
|
+
const createWrapTight = (textWrapping, margins = {
|
|
12553
12645
|
bottom: 0,
|
|
12646
|
+
left: 0,
|
|
12647
|
+
right: 0,
|
|
12554
12648
|
top: 0
|
|
12555
|
-
}) => new BuilderElement({
|
|
12649
|
+
}, extent) => new BuilderElement({
|
|
12556
12650
|
attributes: {
|
|
12557
|
-
|
|
12558
|
-
key: "
|
|
12559
|
-
value: margins.
|
|
12651
|
+
distL: {
|
|
12652
|
+
key: "distL",
|
|
12653
|
+
value: margins.left
|
|
12560
12654
|
},
|
|
12561
|
-
|
|
12562
|
-
key: "
|
|
12563
|
-
value: margins.
|
|
12655
|
+
distR: {
|
|
12656
|
+
key: "distR",
|
|
12657
|
+
value: margins.right
|
|
12658
|
+
},
|
|
12659
|
+
wrapText: {
|
|
12660
|
+
key: "wrapText",
|
|
12661
|
+
value: textWrapping.side || TextWrappingSide.BOTH_SIDES
|
|
12564
12662
|
}
|
|
12565
12663
|
},
|
|
12664
|
+
children: [createWrapPolygon$1(extent.x, extent.y)],
|
|
12566
12665
|
name: "wp:wrapTight"
|
|
12567
12666
|
});
|
|
12568
12667
|
//#endregion
|
|
12668
|
+
//#region src/file/drawing/text-wrap/wrap-through.ts
|
|
12669
|
+
/**
|
|
12670
|
+
* Wrap Through module for DrawingML text wrapping.
|
|
12671
|
+
*
|
|
12672
|
+
* This module provides "through" text wrapping for floating drawings
|
|
12673
|
+
* where text wraps through the image contours, filling any concave areas.
|
|
12674
|
+
*
|
|
12675
|
+
* Reference: http://officeopenxml.com/drwPicFloating-textWrap.php
|
|
12676
|
+
*
|
|
12677
|
+
* @module
|
|
12678
|
+
*/
|
|
12679
|
+
/**
|
|
12680
|
+
* Creates a default rectangular wrap polygon matching the image extent.
|
|
12681
|
+
*
|
|
12682
|
+
* Reference: http://officeopenxml.com/drwPicFloating-textWrap.php
|
|
12683
|
+
*
|
|
12684
|
+
* ## XSD Schema
|
|
12685
|
+
* ```xml
|
|
12686
|
+
* <xsd:complexType name="CT_WrapPath">
|
|
12687
|
+
* <xsd:sequence>
|
|
12688
|
+
* <xsd:element name="start" type="a:CT_Point2D" minOccurs="1" maxOccurs="1"/>
|
|
12689
|
+
* <xsd:element name="lineTo" type="a:CT_Point2D" minOccurs="2" maxOccurs="unbounded"/>
|
|
12690
|
+
* </xsd:sequence>
|
|
12691
|
+
* <xsd:attribute name="edited" type="xsd:boolean" use="optional"/>
|
|
12692
|
+
* </xsd:complexType>
|
|
12693
|
+
* ```
|
|
12694
|
+
*/
|
|
12695
|
+
const createWrapPolygon = (cx, cy) => new BuilderElement({
|
|
12696
|
+
attributes: { edited: {
|
|
12697
|
+
key: "edited",
|
|
12698
|
+
value: "0"
|
|
12699
|
+
} },
|
|
12700
|
+
children: [
|
|
12701
|
+
new BuilderElement({
|
|
12702
|
+
attributes: {
|
|
12703
|
+
x: {
|
|
12704
|
+
key: "x",
|
|
12705
|
+
value: 0
|
|
12706
|
+
},
|
|
12707
|
+
y: {
|
|
12708
|
+
key: "y",
|
|
12709
|
+
value: 0
|
|
12710
|
+
}
|
|
12711
|
+
},
|
|
12712
|
+
name: "wp:start"
|
|
12713
|
+
}),
|
|
12714
|
+
new BuilderElement({
|
|
12715
|
+
attributes: {
|
|
12716
|
+
x: {
|
|
12717
|
+
key: "x",
|
|
12718
|
+
value: 0
|
|
12719
|
+
},
|
|
12720
|
+
y: {
|
|
12721
|
+
key: "y",
|
|
12722
|
+
value: -cy
|
|
12723
|
+
}
|
|
12724
|
+
},
|
|
12725
|
+
name: "wp:lineTo"
|
|
12726
|
+
}),
|
|
12727
|
+
new BuilderElement({
|
|
12728
|
+
attributes: {
|
|
12729
|
+
x: {
|
|
12730
|
+
key: "x",
|
|
12731
|
+
value: cx
|
|
12732
|
+
},
|
|
12733
|
+
y: {
|
|
12734
|
+
key: "y",
|
|
12735
|
+
value: -cy
|
|
12736
|
+
}
|
|
12737
|
+
},
|
|
12738
|
+
name: "wp:lineTo"
|
|
12739
|
+
}),
|
|
12740
|
+
new BuilderElement({
|
|
12741
|
+
attributes: {
|
|
12742
|
+
x: {
|
|
12743
|
+
key: "x",
|
|
12744
|
+
value: cx
|
|
12745
|
+
},
|
|
12746
|
+
y: {
|
|
12747
|
+
key: "y",
|
|
12748
|
+
value: 0
|
|
12749
|
+
}
|
|
12750
|
+
},
|
|
12751
|
+
name: "wp:lineTo"
|
|
12752
|
+
}),
|
|
12753
|
+
new BuilderElement({
|
|
12754
|
+
attributes: {
|
|
12755
|
+
x: {
|
|
12756
|
+
key: "x",
|
|
12757
|
+
value: 0
|
|
12758
|
+
},
|
|
12759
|
+
y: {
|
|
12760
|
+
key: "y",
|
|
12761
|
+
value: 0
|
|
12762
|
+
}
|
|
12763
|
+
},
|
|
12764
|
+
name: "wp:lineTo"
|
|
12765
|
+
})
|
|
12766
|
+
],
|
|
12767
|
+
name: "wp:wrapPolygon"
|
|
12768
|
+
});
|
|
12769
|
+
/**
|
|
12770
|
+
* Creates "through" text wrapping for a floating drawing.
|
|
12771
|
+
*
|
|
12772
|
+
* WrapThrough is similar to WrapTight but allows text to wrap through
|
|
12773
|
+
* the concave portions of the drawing shape (e.g., the inside of the letter "O").
|
|
12774
|
+
* A default rectangular wrap polygon matching the image extent is generated.
|
|
12775
|
+
*
|
|
12776
|
+
* Reference: http://officeopenxml.com/drwPicFloating-textWrap.php
|
|
12777
|
+
*
|
|
12778
|
+
* ## XSD Schema
|
|
12779
|
+
* ```xml
|
|
12780
|
+
* <xsd:complexType name="CT_WrapThrough">
|
|
12781
|
+
* <xsd:sequence>
|
|
12782
|
+
* <xsd:element name="wrapPolygon" type="CT_WrapPath" minOccurs="1" maxOccurs="1"/>
|
|
12783
|
+
* </xsd:sequence>
|
|
12784
|
+
* <xsd:attribute name="wrapText" type="ST_WrapText" use="required"/>
|
|
12785
|
+
* <xsd:attribute name="distL" type="ST_WrapDistance"/>
|
|
12786
|
+
* <xsd:attribute name="distR" type="ST_WrapDistance"/>
|
|
12787
|
+
* </xsd:complexType>
|
|
12788
|
+
* ```
|
|
12789
|
+
*/
|
|
12790
|
+
const createWrapThrough = (textWrapping, margins = {
|
|
12791
|
+
bottom: 0,
|
|
12792
|
+
left: 0,
|
|
12793
|
+
right: 0,
|
|
12794
|
+
top: 0
|
|
12795
|
+
}, extent) => new BuilderElement({
|
|
12796
|
+
attributes: {
|
|
12797
|
+
distL: {
|
|
12798
|
+
key: "distL",
|
|
12799
|
+
value: margins.left
|
|
12800
|
+
},
|
|
12801
|
+
distR: {
|
|
12802
|
+
key: "distR",
|
|
12803
|
+
value: margins.right
|
|
12804
|
+
},
|
|
12805
|
+
wrapText: {
|
|
12806
|
+
key: "wrapText",
|
|
12807
|
+
value: textWrapping.side || TextWrappingSide.BOTH_SIDES
|
|
12808
|
+
}
|
|
12809
|
+
},
|
|
12810
|
+
children: [createWrapPolygon(extent.x, extent.y)],
|
|
12811
|
+
name: "wp:wrapThrough"
|
|
12812
|
+
});
|
|
12813
|
+
//#endregion
|
|
12569
12814
|
//#region src/file/drawing/text-wrap/wrap-top-and-bottom.ts
|
|
12570
12815
|
/**
|
|
12571
12816
|
* Wrap Top and Bottom module for DrawingML text wrapping.
|
|
@@ -13015,7 +13260,16 @@
|
|
|
13015
13260
|
this.root.push(createWrapSquare(drawingOptions.floating.wrap, drawingOptions.floating.margins));
|
|
13016
13261
|
break;
|
|
13017
13262
|
case TextWrappingType.TIGHT:
|
|
13018
|
-
this.root.push(createWrapTight(drawingOptions.floating.margins
|
|
13263
|
+
this.root.push(createWrapTight(drawingOptions.floating.wrap, drawingOptions.floating.margins, {
|
|
13264
|
+
x: transform.emus.x,
|
|
13265
|
+
y: transform.emus.y
|
|
13266
|
+
}));
|
|
13267
|
+
break;
|
|
13268
|
+
case TextWrappingType.THROUGH:
|
|
13269
|
+
this.root.push(createWrapThrough(drawingOptions.floating.wrap, drawingOptions.floating.margins, {
|
|
13270
|
+
x: transform.emus.x,
|
|
13271
|
+
y: transform.emus.y
|
|
13272
|
+
}));
|
|
13019
13273
|
break;
|
|
13020
13274
|
case TextWrappingType.TOP_AND_BOTTOM:
|
|
13021
13275
|
this.root.push(createWrapTopAndBottom(drawingOptions.floating.margins));
|
|
@@ -27918,6 +28172,7 @@
|
|
|
27918
28172
|
exports.createVerticalPosition = createVerticalPosition;
|
|
27919
28173
|
exports.createWrapNone = createWrapNone;
|
|
27920
28174
|
exports.createWrapSquare = createWrapSquare;
|
|
28175
|
+
exports.createWrapThrough = createWrapThrough;
|
|
27921
28176
|
exports.createWrapTight = createWrapTight;
|
|
27922
28177
|
exports.createWrapTopAndBottom = createWrapTopAndBottom;
|
|
27923
28178
|
exports.dateTimeValue = dateTimeValue;
|