In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
Most people do not understand the knowledge of this article "how to use GE language to generate relevant drop-down lists in spreadsheets", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article, let's take a look at this "how to use GE language to generate relevant drop-down lists in spreadsheets" article.
Excelize is a library written in pure Go that provides a set of functions that allow you to write and read XLSX / XLSM / XLTM files. Support for reading and writing spreadsheet documents generated by Microsoft Excel ™2007 and later. Supports complex components with high compatibility and provides streaming API for generating or reading data from worksheets with large amounts of data. This library requires Go 1.15 or later.
Go:
Package mainimport ("fmt"github.com/xuri/excelize/v2") func main () {/ / create a new spreadsheet f: = excelize.NewFile () var (/ / cell values data = [] [] interface {} {"Fruits", "Vegetables"}, {"Mango", "Potato", nil, "Drop Down 1", "Drop Down 2"}, {"Apple" "Tomato"}, {"Grapes", "Spinach"}, {"Strawberry", "Onion"}, {"Kiwi", "Cucumber"},} addr string err error cellsStyle, headerStyle int) / / set each cell value for r, row: = range data {if addr Err = excelize.JoinCellName ("A", ritual 1) Err! = nil {fmt.Println (err) return} if err = f.SetSheetRow ("Sheet1", addr, & row) Err! = nil {fmt.Println (err) return}} / / set data validation dvRange1: = excelize.NewDataValidation (true) dvRange1.Sqref = "D3:D3" dvRange1.SetSqrefDropList ("$A$1:$B$1", true) if err = f.AddDataValidation ("Sheet1", dvRange1) Err! = nil {fmt.Println (err) return} dvRange2: = excelize.NewDataValidation (true) dvRange2.Sqref = "E3:E3" dvRange2.SetSqrefDropList ("INDIRECT (D3)", true) if err = f.AddDataValidation ("Sheet1", dvRange2) Err! = nil {fmt.Println (err) return} / / set defined name if err = f.SetDefinedName (& excelize.DefinedName {Name: "Fruits", RefersTo: "Sheet1 pieces of clothing, Scope:" Sheet1 ",}) Err! = nil {fmt.Println (err) return} if err = f.SetDefinedName (& excelize.DefinedName {Name: "Vegetables", RefersTo: "Sheet1, Scope:" Sheet1 ",}) Err! = nil {fmt.Println (err) return} / / set custom column width for col, width: = range map [string] float64 {"A": 12, "B": 12, "C": 6, "D": 12, "E": 12} {if err = f.SetColWidth ("Sheet1", col, col, width) Err! = nil {fmt.Println (err) return}} / / hide gridlines for the worksheet if err = f.SetSheetViewOptions ("Sheet1", 0, excelize.ShowGridLines (false)) Err! = nil {fmt.Println (err) return} / / define the border style border: = [] excelize.Border {{Type: "top", Style: 1, Color: "cccccc"}, {Type: "left", Style: 1, Color: "cccccc"}, {Type: "right", Style: 1, Color: "cccccc"}, {Type: "bottom", Style: 1 Color: "cccccc"},} / / define the style of cells if cellsStyle, err = f.NewStyle (& excelize.Style {Font: & excelize.Font {Color: "333333"}, Border: border}) Err! = nil {fmt.Println (err) return} / / define the style of the header row if headerStyle, err = f.NewStyle (& excelize.Style {Font: & excelize.Font {Bold: true}, Fill: excelize.Fill {Type: "pattern", Color: [] string {"dae9f3"}, Pattern: 1}, Border: border},) Err! = nil {fmt.Println (err) return} / / set cell style if err = f.SetCellStyle ("Sheet1", "A2", "B6", cellsStyle); err! = nil {fmt.Println (err) return} if err = f.SetCellStyle ("Sheet1", "D3", "E3", cellsStyle) Err! = nil {fmt.Println (err) return} / / set cell style for the header row if err = f.SetCellStyle ("Sheet1", "A1", "B1", headerStyle); err! = nil {fmt.Println (err) return} if err = f.SetCellStyle ("Sheet1", "D2", "E2", headerStyle) Err! = nil {fmt.Println (err) return} / / save spreadsheet file if err: = f.SaveAs ("Book1.xlsx") Err! = nil {fmt.Println (err)}} above is about "how to use GE language to generate relevant drop-down lists in spreadsheets". I believe you all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.