Subject: VSTO - Save XLT as XLS , Controls missing
Posted By: vinodjv Post Date: 7/3/2008 6:58:50 AM
All,

I have an XLT file, i am creating runtime workseets in that XLT. While creating the runtime worsheets, i am adding runtime control(eg combo box) as well. After running the VSTO project i will get the XLT out put with desired number of worksheets and dynamic controls. I save this XLT to XLS, and when i open the XLS the dynamically added controls are not there.

Any thoughts........


Reply By: samjudson Reply Date: 7/3/2008 7:25:30 AM
My thoughts are that we can't see your code, nor know what the output looks like so we can't possibly know what might be wrong.

/- Sam Judson : Wrox Technical Editor -/
Reply By: vinodjv Reply Date: 7/3/2008 7:57:27 AM
Hi Sam,

Here is the code snippet....

We are dynamically creating the worksheets and adding the combo box at runtime by using the method AddCombo() as below.

So when i run the application , XLT comes with the dynamically created worksheets and the combo box embeded in that. I am trying to save this XLT as XLS. When i open the XLS , the runtime added combobox appears for a second and disappears


     using ExVSTO = Microsoft.Office.Tools.Excel;

    public static ExVSTO.Controls.ComboBox AddCombo()
            
        {
            ExVSTO.Controls.ComboBox cmbControl=null;
            
           try
            {
                ExVSTO.Worksheet wsVSTO = Globals.WorkSheet;
                cmbControl = wsVSTO.Controls.AddComboBox(10,20,30,40, "Test");
                cmbControl.Items.Add("Apple");
                cmbControl.Items.Add("Mango");
                cmbControl.Visible = true;
                cmbControl.BringToFront();
                
            }
            catch (Exception ex)
            {
                
            }
            return cmbControl;
        }


Go to topic 72483

Return to index page 1