Skip to content

Commit

Permalink
Add new TickLabelPosition field in the ChartAxis data type
Browse files Browse the repository at this point in the history
- Introduce new exported ChartTickLabelPositionType enumeration
- SetCellHyperLink function now support remove hyperlink by None linkType
- Upgrade the dependencies package version
  • Loading branch information
xuri committed Jul 15, 2024
1 parent 5dea100 commit bd65563
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 37 deletions.
8 changes: 4 additions & 4 deletions cmd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.18

require (
github.com/stretchr/testify v1.8.4
github.com/xuri/excelize/v2 v2.8.2-0.20240621001312-4e6457accde3
golang.org/x/image v0.15.0
github.com/xuri/excelize/v2 v2.8.2-0.20240713024157-9c278365f213
golang.org/x/image v0.18.0
)

require (
Expand All @@ -16,8 +16,8 @@ require (
github.com/richardlehane/msoleps v1.0.3 // indirect
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d // indirect
github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/crypto v0.25.0 // indirect
golang.org/x/net v0.27.0 // indirect
golang.org/x/text v0.16.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
16 changes: 8 additions & 8 deletions cmd/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d h1:llb0neMWDQe87IzJLS4Ci7psK/lVsjIS2otl+1WyRyY=
github.com/xuri/efp v0.0.0-20240408161823-9ad904a10d6d/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
github.com/xuri/excelize/v2 v2.8.2-0.20240621001312-4e6457accde3 h1:BmS5KxI0igAy1uF7YVLT5X03Omx9BPSffsxXdkrl6/A=
github.com/xuri/excelize/v2 v2.8.2-0.20240621001312-4e6457accde3/go.mod h1:V3gxebTnbQrNjSPmqW574uhxzXqzSgjNU4iyusK8WoA=
github.com/xuri/excelize/v2 v2.8.2-0.20240713024157-9c278365f213 h1:cdWe1AJcvApomqtIMBow4tvD+x7heU4AEilR8+HIUzo=
github.com/xuri/excelize/v2 v2.8.2-0.20240713024157-9c278365f213/go.mod h1:0hWeRQBdU+HQng3S1AXdYm8Ob0dbevUncXAWI0QswPU=
github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7 h1:hPVCafDV85blFTabnqKgNhDCkJX25eik94Si9cTER4A=
github.com/xuri/nfp v0.0.0-20240318013403-ab9948c2c4a7/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
golang.org/x/image v0.15.0 h1:kOELfmgrmJlw4Cdb7g/QGuB3CvDrXbqEIww/pNtNBm8=
golang.org/x/image v0.15.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE=
golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ=
golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE=
golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30=
golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M=
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys=
golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE=
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
Expand Down
18 changes: 12 additions & 6 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// writing spreadsheet documents generated by Microsoft Excel™ 2007 and later.
// Supports complex components by high compatibility, and provided streaming
// API for generating or reading data from a worksheet with huge amounts of
// data. This library needs Go version 1.16 or later.
// data. This library needs Go version 1.18 or later.

package main

Expand Down Expand Up @@ -274,6 +274,11 @@ func regConstants() {
"ChartDataLabelsPositionOutsideEnd": int(excelize.ChartDataLabelsPositionOutsideEnd),
"ChartDataLabelsPositionRight": int(excelize.ChartDataLabelsPositionRight),
"ChartDataLabelsPositionAbove": int(excelize.ChartDataLabelsPositionAbove),
// ChartTickLabelPositionType enumeration
"ChartTickLabelNextToAxis": int(excelize.ChartTickLabelNextToAxis),
"ChartTickLabelHigh": int(excelize.ChartTickLabelHigh),
"ChartTickLabelLow": int(excelize.ChartTickLabelLow),
"ChartTickLabelNone": int(excelize.ChartTickLabelNone),
// PictureInsertType enumeration
"PictureInsertTypePlaceOverCells": int(excelize.PictureInsertTypePlaceOverCells),
"PictureInsertTypePlaceInCell": int(excelize.PictureInsertTypePlaceInCell),
Expand Down Expand Up @@ -3089,12 +3094,13 @@ func SetCellFormula(f *excelize.File) func(this js.Value, args []js.Value) inter
}

// SetCellHyperLink provides a function to set cell hyperlink by given
// worksheet name and link URL address. LinkType defines two types of
// worksheet name and link URL address. LinkType defines three types of
// hyperlink "External" for website or "Location" for moving to one of cell in
// this workbook. Maximum limit hyperlinks in a worksheet is 65530. This
// function is only used to set the hyperlink of the cell and doesn't affect
// the value of the cell. If you need to set the value of the cell, please use
// the other functions such as `SetCellStyle` or `SetSheetRow`.
// this workbook or "None" for remove hyperlink. Maximum limit hyperlinks in a
// worksheet is 65530. This function is only used to set the hyperlink of the
// cell and doesn't affect the value of the cell. If you need to set the value
// of the cell, please use the other functions such as `SetCellStyle` or
// `SetSheetRow`.
func SetCellHyperLink(f *excelize.File) func(this js.Value, args []js.Value) interface{} {
return func(this js.Value, args []js.Value) interface{} {
ret := map[string]interface{}{"error": nil}
Expand Down
66 changes: 47 additions & 19 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,19 +399,20 @@ declare module 'excelize-wasm' {
* ChartAxis directly maps the format settings of the chart axis.
*/
export type ChartAxis = {
None?: boolean;
MajorGridLines?: boolean;
MinorGridLines?: boolean;
MajorUnit?: number;
TickLabelSkip?: number;
ReverseOrder?: boolean;
Secondary?: boolean;
Maximum?: number;
Minimum?: number;
Font?: Font;
LogBase?: number;
NumFmt?: ChartNumFmt;
Title?: RichTextRun[];
None?: boolean;
MajorGridLines?: boolean;
MinorGridLines?: boolean;
MajorUnit?: number;
TickLabelPosition?: ChartTickLabelPositionType;
TickLabelSkip?: number;
ReverseOrder?: boolean;
Secondary?: boolean;
Maximum?: number;
Minimum?: number;
Font?: Font;
LogBase?: number;
NumFmt?: ChartNumFmt;
Title?: RichTextRun[];
};

/**
Expand Down Expand Up @@ -523,6 +524,17 @@ declare module 'excelize-wasm' {
ChartDataLabelsPositionAbove,
}

/**
* ChartTickLabelPositionType is the type of supported chart tick label
* position types.
*/
export enum ChartTickLabelPositionType {
ChartTickLabelNextToAxis,
ChartTickLabelHigh,
ChartTickLabelLow,
ChartTickLabelNone,
}

/**
* Chart directly maps the format settings of the chart.
*/
Expand Down Expand Up @@ -800,10 +812,21 @@ declare module 'excelize-wasm' {
* MergeCell define a merged cell data.
*/
export interface MergeCell {
/**
* GetCellValue returns merged cell value.
*/
GetCellValue: () => string;
/**
* GetStartAxis returns the top left cell reference of merged range, for
* example: "C2".
*/
GetStartAxis: () => string;
/**
* GetEndAxis returns the bottom right cell reference of merged range, for
* example: "D4".
*/
GetEndAxis: () => string;
};
}

/**
* PageLayoutOptions directly maps the settings of page layout.
Expand Down Expand Up @@ -2762,12 +2785,13 @@ declare module 'excelize-wasm' {

/**
* SetCellHyperLink provides a function to set cell hyperlink by given
* worksheet name and link URL address. LinkType defines two types of
* worksheet name and link URL address. LinkType defines three types of
* hyperlink "External" for website or "Location" for moving to one of cell
* in this workbook. Maximum limit hyperlinks in a worksheet is 65530. This
* function is only used to set the hyperlink of the cell and doesn't
* affect the value of the cell. If you need to set the value of the cell,
* please use the other functions such as `SetCellStyle` or `SetSheetRow`.
* in this workbook or "None" for remove hyperlink. Maximum limit hyperlinks
* in a worksheet is 65530. This function is only used to set the hyperlink
* of the cell and doesn't affect the value of the cell. If you need to set
* the value of the cell, please use the other functions such as
* `SetCellStyle` or `SetSheetRow`.
* @param sheet The worksheet name
* @param cell The cell reference
* @param link The hyperlink
Expand Down Expand Up @@ -3655,5 +3679,9 @@ declare module 'excelize-wasm' {
ChartDataLabelsPositionOutsideEnd: typeof ChartDataLabelPositionType.ChartDataLabelsPositionOutsideEnd;
ChartDataLabelsPositionRight: typeof ChartDataLabelPositionType.ChartDataLabelsPositionRight;
ChartDataLabelsPositionAbove: typeof ChartDataLabelPositionType.ChartDataLabelsPositionAbove;
ChartTickLabelNextToAxis: typeof ChartTickLabelPositionType.ChartTickLabelNextToAxis;
ChartTickLabelHigh: typeof ChartTickLabelPositionType.ChartTickLabelHigh;
ChartTickLabelLow: typeof ChartTickLabelPositionType.ChartTickLabelLow;
ChartTickLabelNone: typeof ChartTickLabelPositionType.ChartTickLabelNone;
}>;
}

0 comments on commit bd65563

Please sign in to comment.