2018-06-08 16:03:04 +02:00
|
|
|
// http://officeopenxml.com/drwPicFloating-position.php
|
2020-12-25 00:07:57 +00:00
|
|
|
// http://officeopenxml.com/drwPicFloating.php
|
2022-06-26 23:26:42 +01:00
|
|
|
import { HorizontalPositionAlign, VerticalPositionAlign } from "@file/shared/alignment";
|
2021-03-14 17:00:42 +00:00
|
|
|
|
2019-01-10 02:10:20 +00:00
|
|
|
import { ITextWrapping } from "../text-wrap";
|
2018-06-08 16:03:04 +02:00
|
|
|
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* Horizontal Relative Positioning
|
|
|
|
*
|
|
|
|
* Reference: https://www.datypic.com/sc/ooxml/t-wp_ST_RelFromH.html
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
export const HorizontalPositionRelativeFrom = {
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Character
|
|
|
|
*
|
|
|
|
* Specifies that the horizontal positioning shall be relative to the position of the anchor within its run content.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
CHARACTER: "character",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Column
|
|
|
|
*
|
|
|
|
* Specifies that the horizontal positioning shall be relative to the extents of the column which contains its anchor.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
COLUMN: "column",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Inside Margin
|
|
|
|
*
|
|
|
|
* Specifies that the horizontal positioning shall be relative to the inside margin of the current page (the left margin on odd pages, right on even pages).
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
INSIDE_MARGIN: "insideMargin",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Left Margin
|
|
|
|
*
|
|
|
|
* Specifies that the horizontal positioning shall be relative to the left margin of the page.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
LEFT_MARGIN: "leftMargin",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Page Margin
|
|
|
|
*
|
|
|
|
* Specifies that the horizontal positioning shall be relative to the page margins.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
MARGIN: "margin",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Outside Margin
|
|
|
|
*
|
|
|
|
* Specifies that the horizontal positioning shall be relative to the outside margin of the current page (the right margin on odd pages, left on even pages).
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
OUTSIDE_MARGIN: "outsideMargin",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Page Edge
|
|
|
|
*
|
|
|
|
* Specifies that the horizontal positioning shall be relative to the edge of the page.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
PAGE: "page",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Right Margin
|
|
|
|
*
|
|
|
|
* Specifies that the horizontal positioning shall be relative to the right margin of the page.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
RIGHT_MARGIN: "rightMargin",
|
|
|
|
} as const;
|
2018-06-08 16:03:04 +02:00
|
|
|
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* Vertical Relative Positioning
|
|
|
|
*
|
|
|
|
* Reference: https://www.datypic.com/sc/ooxml/t-wp_ST_RelFromV.html
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
export const VerticalPositionRelativeFrom = {
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Bottom Margin
|
|
|
|
*
|
|
|
|
* Specifies that the vertical positioning shall be relative to the bottom margin of the current page.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
BOTTOM_MARGIN: "bottomMargin",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Inside Margin
|
|
|
|
*
|
|
|
|
* Specifies that the vertical positioning shall be relative to the inside margin of the current page.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
INSIDE_MARGIN: "insideMargin",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Line
|
|
|
|
*
|
|
|
|
* Specifies that the vertical positioning shall be relative to the line containing the anchor character.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
LINE: "line",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Page Margin
|
|
|
|
*
|
|
|
|
* Specifies that the vertical positioning shall be relative to the page margins.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
MARGIN: "margin",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Outside Margin
|
|
|
|
*
|
|
|
|
* Specifies that the vertical positioning shall be relative to the outside margin of the current page.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
OUTSIDE_MARGIN: "outsideMargin",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Page Edge
|
|
|
|
*
|
|
|
|
* Specifies that the vertical positioning shall be relative to the edge of the page.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
PAGE: "page",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Paragraph
|
|
|
|
*
|
|
|
|
* Specifies that the vertical positioning shall be relative to the paragraph which contains the drawing anchor.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
PARAGRAPH: "paragraph",
|
2025-04-14 16:43:15 +05:30
|
|
|
/**
|
|
|
|
* ## Top Margin
|
|
|
|
*
|
|
|
|
* Specifies that the vertical positioning shall be relative to the top margin of the current page.
|
|
|
|
*/
|
2023-12-22 10:25:00 +09:00
|
|
|
TOP_MARGIN: "topMargin",
|
|
|
|
} as const;
|
2018-06-08 16:03:04 +02:00
|
|
|
|
2024-10-21 03:57:15 +01:00
|
|
|
export type IHorizontalPositionOptions = {
|
2023-12-22 10:25:00 +09:00
|
|
|
readonly relative?: (typeof HorizontalPositionRelativeFrom)[keyof typeof HorizontalPositionRelativeFrom];
|
|
|
|
readonly align?: (typeof HorizontalPositionAlign)[keyof typeof HorizontalPositionAlign];
|
2018-11-02 02:51:57 +00:00
|
|
|
readonly offset?: number;
|
2024-10-21 03:57:15 +01:00
|
|
|
};
|
2018-06-08 16:03:04 +02:00
|
|
|
|
2024-10-21 03:57:15 +01:00
|
|
|
export type IVerticalPositionOptions = {
|
2023-12-22 10:25:00 +09:00
|
|
|
readonly relative?: (typeof VerticalPositionRelativeFrom)[keyof typeof VerticalPositionRelativeFrom];
|
|
|
|
readonly align?: (typeof VerticalPositionAlign)[keyof typeof VerticalPositionAlign];
|
2018-11-02 02:51:57 +00:00
|
|
|
readonly offset?: number;
|
2024-10-21 03:57:15 +01:00
|
|
|
};
|
2018-06-08 16:03:04 +02:00
|
|
|
|
2024-10-21 03:57:15 +01:00
|
|
|
export type IMargins = {
|
2019-01-10 02:10:20 +00:00
|
|
|
readonly left?: number;
|
|
|
|
readonly bottom?: number;
|
|
|
|
readonly top?: number;
|
|
|
|
readonly right?: number;
|
2024-10-21 03:57:15 +01:00
|
|
|
};
|
2019-01-10 02:10:20 +00:00
|
|
|
|
2024-10-21 03:57:15 +01:00
|
|
|
export type IFloating = {
|
2018-11-02 02:51:57 +00:00
|
|
|
readonly horizontalPosition: IHorizontalPositionOptions;
|
|
|
|
readonly verticalPosition: IVerticalPositionOptions;
|
|
|
|
readonly allowOverlap?: boolean;
|
|
|
|
readonly lockAnchor?: boolean;
|
|
|
|
readonly behindDocument?: boolean;
|
|
|
|
readonly layoutInCell?: boolean;
|
2019-01-10 02:10:20 +00:00
|
|
|
readonly margins?: IMargins;
|
|
|
|
readonly wrap?: ITextWrapping;
|
2020-12-25 00:07:57 +00:00
|
|
|
readonly zIndex?: number;
|
2024-10-21 03:57:15 +01:00
|
|
|
};
|