簡體   English   中英

C#Excel 2013插件,將值寫入所選單元格

[英]C# Excel 2013 Addin, write value to the selected cell

嘗試將字符串寫入Excel 2013中的當前活動單元格時,我正在使用Visual Studio 2013 C#創建Office加載項。

我可以到達可以在Windows窗體窗口中當前選定的單元格中獲取值的部分,但是我很難將其寫回Excel。

Excel.Range currentSelectedCell = Globals.ThisWorkbook.Application.ActiveCell;
//output to an object
object cellValue = currentSelectedCell.Value;

//convert object to a string that can be displayed
Convert.ToInt32(cellValue);

//finally display the string inside a textbox
myTextbox.Text = cellValue.ToString();

// how to get myTextbox.Text to> object to> Globals.ThisWorkbook.Application.ActiveCell ?

歡迎任何幫助。

獲得的值幾乎相同:

Excel.Range currentSelectedCell = Globals.ThisWorkbook.Application.ActiveCell;
currentSelectedCell.Value = myTextbox.Text;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM