Hello,
Thank you for your inquiry.
For questions 1 and 2, do you want to write the names of all excel files in the combobox, and write the names of all the visible worksheets of the excel file selected in the first combobox in another combobox? If it is, in fact this operation has nothing to do with our product. Please check the code below to write excel file name and worksheet name into combobox respectively.
- Code: Select all
//Write excel file name into combobox1
comboBox1.Items.Add("excel1.xlsx");
comboBox1.Items.Add("excel2.xlsx");
comboBox1.Items.Add("excel3.xlsx");
comboBox1.Items.Add("excel4.xlsx");
...
//Write the names of all visible worksheets of the specified excel file into the combobox2
comboBox2.Items.Add("sheet1Name");
comboBox2.Items.Add("sheet2Name");
comboBox2.Items.Add("sheet3Name");
...
For question 3, our Spire.XLS supports writing content in specific cells of the worksheet, please refer to the code below.
- Code: Select all
//Get the excel file name selected in the combobox
string files = this.comboBox1.Text;
Workbook book = new Workbook();
//Load excel file
book.LoadFromFile(files);
//Get the worksheet according to the worksheet name
Worksheet sheet = book.Worksheets[this.comboBox2.Text];
//Write the information in combobox1 into cell "A4"
sheet.Range["A4"].Text = this.comboBox1.Text;
...
//Save the file
book.SaveToFile("", FileFormat.Version2013);
Sincerely,
Annika
E-iceblue support team