ShapeAppCSharp Add-In: Excel Data Entry- Updated with Beta Fix


posted by Melody
01-22-2008

Downloads: 101
File size: 656.9kB
Views: 361
ShapeAppCSharp Add-In: Excel Data Entry- Updated with Beta Fix
Filed under: , , ,

This sample demonstrates the use of VSTA to extend a host applicaiton to use a technology, Excel, without any changes being made to the host.  The add-ins included use an Excel 2003 spreadsheet as a data entry form. 

To use Office applications in VSTA, add references to the appropriate assemblies.  For VSTA v 1, to add a reference to the Excel application, choose the "Microsoft Excel # Object Library" from the COM tab of the Add References window, it should have a path like %ProgramFiles%\Microsoft Office\OFFICE#\EXCEL.EXE.  This will add the entries "Excel" and "Microsoft.Office.Core" (which can be removed) under references in the Solution Explorer.  When viewed in the Object Browser, the "Excel" entry is identified as Microsoft.Office.Interop.Excel.dll.  For VSTA v 2, the Microsoft.Office.Interop.Excel reference is listed on the .Net tab of the Add References window. 

The download includes two samples- one for VSTA v 1 and one for VSTA v 2.  Both samples use the included Excel 2003 spreadsheet which should be copied to "C:\VSTA\Summit Software\Samples".    To use a different version of Excel with this sample, swap out the excel reference.  To use a different file or file location, update the string passed to the OpenExcelFile method. 

To use this sample:
1)  Follow the steps outlined in the SDK to extract, build, and register the ShapeAppBasicCSharp sample included with the SDK.

2)  Copy the excel file included into "C:\VSTA\Summit Software\Samples", or update the add-in with the new location.

3)  Extract and build the add-in approriate for the VSTA version in use.  Once built, the add-in will install its assembly in %My Documents%\ShapeAppCSharp\AppAddIns where ShapeAppBasicCSharp (or above) will find it.

4)  Run the ShapeAppBasicCSharp sample.

 

*******************

Previously, the VSTA v 2 sample used only the shape name as input.  This was due to a bug with multiple calls to static methods which has been fixed in the beta release.  Any questions about this sample may be posted on the forums.

 

Copyright Summit Software Company, 2008. All rights reserved.