View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jialiang Ge [MSFT] Jialiang Ge [MSFT] is offline
external usenet poster
 
Posts: 118
Default Saving changes to Excel file when using VSTO

Hello Ed,

The behaviors of #2, #3 are by design. When we create a VSTO Excel workbook
project, Visual Studio creates an Excel workbook file for us in the project
folder /Visual Studio/Projects/{Project Name}/{ Project Name }/. This Excel
workbook file is one we see in Visual Studio Designer. After we compile the
project, VS will create a new copy from this workbook to the sub folder
/bin/Debug, as well as other files like manifest and dll assembly. The new
workbook in the /bin/Debug folder is the one we see in debugging or after
the distribution.

For your question of how to update the workbook in the VSTO project without
losing the end user modification, you may consider this step list:

1. Distribute the VSTO solution to the end user (the files in the bin
folder), and the end user makes the modifications in the workbook.
2. We get the new workbook file from the end user.
3. Remove the customizations of the workbook by calling
Workbook.RemoveCustomization from a Excel automation client (You may build
such a client app by following the MSDN article
http://msdn.microsoft.com/en-us/library/bb772099.aspx)
4. Replace the workbook in the Visual Studio/Projects/{Project Name}/{
Project Name }/ folder with the resulting xlsx of step 3.
5. Open the VSTO project and continue our programming.

Please note that the step 3 is a must, otherwise, you may get the error "An
error occurred while attempting to persiste the data. The message returned
is: The document is already customized". The reason is explained at the
MSDN forum thread:
http://forums.microsoft.com/MSDN/Sho...74217&SiteID=1

Please have a try and let me know whether this step list fits your
requests. If you have any other concerns or questions, DON'T hesitate to
tell me.

Have a nice day!

Regards,
Jialiang Ge , remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.