Text wrapping and borders for images
This commit is contained in:
@ -1,10 +1,15 @@
|
||||
// http://officeopenxml.com/drwPicFloating-textWrap.php
|
||||
import { XmlAttributeComponent, XmlComponent } from "file/xml-components";
|
||||
import { ITextWrapping, WrapTextOption } from ".";
|
||||
import { ITextWrapping, TextWrappingSide } from ".";
|
||||
import { IDistance } from "../drawing";
|
||||
import { IMargins } from "../floating";
|
||||
|
||||
interface IWrapSquareAttributes extends IDistance {
|
||||
readonly wrapText?: WrapTextOption;
|
||||
readonly wrapText?: TextWrappingSide;
|
||||
readonly distT?: number;
|
||||
readonly distB?: number;
|
||||
readonly distL?: number;
|
||||
readonly distR?: number;
|
||||
}
|
||||
|
||||
class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes> {
|
||||
@ -18,13 +23,24 @@ class WrapSquareAttributes extends XmlAttributeComponent<IWrapSquareAttributes>
|
||||
}
|
||||
|
||||
export class WrapSquare extends XmlComponent {
|
||||
constructor(textWrapping: ITextWrapping) {
|
||||
constructor(
|
||||
textWrapping: ITextWrapping,
|
||||
margins: IMargins = {
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
},
|
||||
) {
|
||||
super("wp:wrapSquare");
|
||||
|
||||
this.root.push(
|
||||
new WrapSquareAttributes({
|
||||
wrapText: textWrapping.wrapTextOption || WrapTextOption.BOTH_SIDES,
|
||||
...textWrapping.distanceFromText,
|
||||
wrapText: textWrapping.side || TextWrappingSide.BOTH_SIDES,
|
||||
distT: margins.top,
|
||||
distB: margins.bottom,
|
||||
distL: margins.left,
|
||||
distR: margins.right,
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user