Clark Kent
Posts: 19
Joined: 2008-03-26
|
First of all, let me say that you've got a great product here - kudos to you!
I'm pretty new to office programming and anything COM so please bear with me :|
I've created an AddinModule solution and within that I've got a TaskPaneManger which contains one TaskPane Collection and that collection contains one TaskPane.
I've also got a commandbar with a few buttons.
I've added a few windows forms controls to the task pane(button and a label).
What I'm wanting to do is the following:
1. Reference my current Excel session from the TaskPane codebehind - more specifically from the button click event. I can currently do this in my AddinModule.cs code behind like this:
ExcelApp.ActiveCell.Value = "my text";
However, I am unsure how to do that from the code behind of my TaskPane. Does that make sense?
2. Basically the opposite of #1 above. I want to set the label in my Task Pane from the value of some text in my excel session. Would I need to set the properties of the control using the get/set (just like if I were using a user control?)
Oh yeah, and I'm doing this in C#
I appreciate any help you can provide. Thank you! |
|
Clark Kent
Posts: 19
Joined: 2008-03-26
|
Of course since I posted this I was able to get #1 to work using the ExcelAppObj object.
//create new excel object
private Excel.Application excelApp = null;
//inside my button click on my task pane
excelApp = this.ExcelAppObj as Excel.Application;
excelApp.ActiveCell.Value = txtSubmit.Text;
Any suggestions on how to go about #2 above? |
|
Fedor Shihantsov
Guest
|
Hello Clark,
Use the ADXExcelTaskPanesCollectionItem.TaskPaneInstance property:
if (adxExcelTaskPanesManager1.Items[0].TaskPaneInstance != null)
{
(adxExcelTaskPanesManager1.Items[0].TaskPaneInstance as ADXExcelTaskPane1).label1.Text = 'any text';
}
|
|
Clark Kent
Posts: 19
Joined: 2008-03-26
|
Fedor, thank you very much. I've got it figured out with your help. Have a great day! |
|