@@ -1004,21 +1004,79 @@ export class Anchor implements IAnchor {
10041004
10051005 constructor ( model ?: IAnchor | object ) ;
10061006}
1007- export interface ImageRange {
1007+ export interface DrawingRange {
10081008 tl : Anchor ;
10091009 br : Anchor ;
10101010}
10111011
1012- export interface ImagePosition {
1012+ export interface DrawingPosition {
10131013 tl : { col : number ; row : number } ;
10141014 ext : { width : number ; height : number } ;
10151015}
10161016
1017- export interface ImageHyperlinkValue {
1017+ export interface DrawingHyperlinkValue {
10181018 hyperlink : string ;
10191019 tooltip ?: string ;
10201020}
10211021
1022+ export interface ShapeProps {
1023+ /**
1024+ * Defined as DocumentFormat.OpenXml.Drawing.ShapeTypeValues in Open API Spec.
1025+ * See https://learn.microsoft.com/ja-jp/dotnet/api/documentformat.openxml.drawing.shapetypevalues
1026+ */
1027+ type : string ;
1028+ rotation ?: number ;
1029+ horizontalFlip ?: boolean ;
1030+ verticalFlip ?: boolean ;
1031+ fill ?: ShapeFill ;
1032+ outline ?: ShapeOutline ;
1033+ textBody ?: ShapeTextBody ;
1034+ }
1035+
1036+ export type ShapeFill = {
1037+ type : 'solid' ,
1038+ color : { theme ?: string , rgb ?: string }
1039+ }
1040+
1041+ export interface ShapeArrowEnd {
1042+ type ?: 'triangle' | 'arrow' | 'stealth' | 'diamond' | 'oval' ;
1043+ length ?: 'lg' | 'med' | 'sm' ;
1044+ width ?: 'lg' | 'med' | 'sm' ;
1045+ }
1046+
1047+ export type ShapeOutline = {
1048+ weight ?: number ,
1049+ color ?: { theme ?: string , rgb ?: string } ,
1050+ dash ?: 'solid' | 'sysDot' | 'sysDash' | 'dash' | 'dashDot' | 'lgDash' | 'lgDashDot' | 'lgDashDotDot' ,
1051+ arrow ?: {
1052+ head ?: ShapeArrowEnd ,
1053+ tail ?: ShapeArrowEnd
1054+ }
1055+ }
1056+
1057+ export type ShapeTextBody = {
1058+ paragraphs : ShapeParagraph [ ] ,
1059+ vertAlign ?: 't' | 'ctr' | 'b' ,
1060+ }
1061+
1062+ export type ShapeParagraph = {
1063+ runs : ShapeRun [ ] ,
1064+ alignment ?: 'l' | 'ctr' | 'r' ,
1065+ }
1066+
1067+ export type ShapeRun = {
1068+ text : string ,
1069+ font ?: Partial < ShapeRunFont > ,
1070+ }
1071+
1072+ export type ShapeRunFont = {
1073+ size : number ,
1074+ color : { theme ?: string , rgb ?: string } ,
1075+ bold : boolean ,
1076+ italic : boolean ,
1077+ underline : 'sng' | 'dbl' | 'none' ,
1078+ }
1079+
10221080export interface Range extends Location {
10231081 sheetName : string ;
10241082
@@ -1458,14 +1516,21 @@ export interface Worksheet {
14581516 * Using the image id from `Workbook.addImage`,
14591517 * embed an image within the worksheet to cover a range
14601518 */
1461- addImage ( imageId : number , range : string | { editAs ?: string ; } & ImageRange & { hyperlinks ?: ImageHyperlinkValue } | { editAs ?: string ; } & ImagePosition & { hyperlinks ?: ImageHyperlinkValue } ) : void ;
1519+ addImage ( imageId : number , range : string | { editAs ?: string ; } & DrawingRange & { hyperlinks ?: DrawingHyperlinkValue } | { editAs ?: string ; } & DrawingPosition & { hyperlinks ?: DrawingHyperlinkValue } ) : void ;
14621520
14631521 getImages ( ) : Array < {
14641522 type : 'image' ,
1465- imageId : string ;
1466- range : ImageRange ;
1523+ imageId : string ,
1524+ range : DrawingRange ,
14671525 } > ;
14681526
1527+ addShape ( props : ShapeProps , range : string | { editAs ?: string ; } & DrawingRange | { editAs ?: string ; } & DrawingPosition , hyperlinks ?: DrawingHyperlinkValue ) : void ;
1528+
1529+ getShapes ( ) : Array < {
1530+ props : ShapeProps ,
1531+ range : DrawingRange ,
1532+ } >
1533+
14691534 commit ( ) : void ;
14701535
14711536 model : WorksheetModel ;
0 commit comments