Removing Customizations from a .XLSX file
In VSTO2005 if you wish to remove the customization from your .xls file, you can simply do the following
if (File.Exists(documentPath) &&ServerDocument.IsCustomized(documentPath))ServerDocument.RemoveCustomization(documentPath); This does not work for a .xlsx file. I have been told that I need to modify the XML inside of the .XLSX file, but I am not sure where this is held. I have extracted all the elements out of the .XLSX archive, and searched for anything that might look like our customization, but could not find anything.
The .XLS file has a section that looks like this
<assembly xmlns="urn
chemas-microsoft-com:asm.v1" xmlns:asmv2="urn
chemas-microsoft-com:asm.v2" manifestVersion="1.0">
<assemblyIdentity name="FastStatsWorkbook.dll" version="1.0.0.0" />
<asmv2:entryPoint name="Startup" dependencyName="dependency0">
<asmv2:clrClassInvocation class="Apteco.Excelsior.Workbook.ThisWorkbook" />
</asmv2:entryPoint>
<asmv2:entryPoint name="Startup" dependencyName="dependency0">
<asmv2:clrClassInvocation class="Apteco.Excelsior.Workbook.Sheet1" />
</asmv2:entryPoint>
<asmv2:entryPoint name="Startup" dependencyName="dependency0">
<asmv2:clrClassInvocation class="Apteco.Excelsior.Workbook.Sheet2" />
</asmv2:entryPoint>
<asmv2:entryPoint name="Startup" dependencyName="dependency0">
<asmv2:clrClassInvocation class="Apteco.Excelsior.Workbook.Sheet3" />
</asmv2:entryPoint>
<asmv2
ependency asmv2:name="dependency0">
<asmv2
ependentAssembly>
<assemblyIdentity name="Apteco.Excelsior.Workbook" version="1.0.0.0" />
</asmv2
ependentAssembly>
<asmv2:installFrom codebase="C:\Program Files\Apteco\FastStats Excelsior\Apteco.Excelsior.Workbook.dll" />
</asmv2
ependency>
</assembly
Any help would again be appreciated in a way of removing the customization
Thanks
Simon
[3160 byte] By [
SiH] at [2008-2-25]
Hi Simon,
Document level customization is only supported in Visual Studio 2008. VS2008 is still in Beta2. You used VS2008 to create your excel file, right?
I try to reproduce your scenario(create a customization workbook using Orcas, and only write a MessageBox.Show statement in the star_up function) and find your xml posted above seems from "ExcelWorkbook1\vstoDataStore\item1.xml", right?
I also find if we want to remove the customization, we should perform these steps:
1. Change your workbook's extensioin to .zip from .xlsx
2. Extract the file ExcelWorkbook1.zip, and you get a folder named ExcelWorkbook1
3. Delete custom.xml in ExcelWorkbook1\docProps
4. Delete four relationships related to custom.xml in these two files (ExcelWorkbook1\_rels\.rels.xml and ExcelWorkbook1\xl\_rels\workbook.xml.rels.xml)
5. Zip all folders and files in ExcelWorkbook1 into a .zip file. Change it's extension back to .xlsx
6. Open the workbook, in myside, the messagebox does not show up. Everything works OK.
I will mark this as answer for it works in my side. Please unmark it if you still can not get it worked through this means, and feel free to let me know. Then we will have a future discussion :-)
Thanks
Ji
Ji,
I am using Visual Studio 2005 with the VSTO2005. This is how I have created my document customization. However, I have clients that have Office 2007, they open the template with the customisation, and then save it as a 2007 .xlsx file.
This is all very well, but at some point I want them to be able to "Publish" the .xlsx file, and in order to do that I do a SaveCopyAs and then need to remove the customization.
I have found the custom.xml file, and it looks like this
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
- <Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="2" name="_AssemblyName">
<vt:lpwstr>*</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="3" name="_AssemblyLocation">
<vt:lpwstr>{67507e7f-f342-4313-84b0-55a7a018b038}</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="4" name="FSO_Table_Weekly_Sales_Summary__This_v_Last_YTD_f9ad901cd57b496b92a91d66f691f8b1_Description">
<vt:lpwstr>Weekly Sales Summary - This v Last YTD.xml</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="5" name="FSO_Table_Weekly_Sales_Summary__This_v_Last_YTD_f9ad901cd57b496b92a91d66f691f8b1_Data">
<vt:lpwstr>\\?FastStatsBaseDirectory\hols2007\0\Public:\Reportables\Demo\Weekly Sales Summary - This v Last YTD.xml</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="23" name="FSO_Excelsior_Now_3d8f5fa72db44b9fa8f73ae4c775f576_Description">
<vt:lpwstr>Refresh Date</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="24" name="FSO_Excelsior_Now_3d8f5fa72db44b9fa8f73ae4c775f576_Data">
<vt:lpwstr>Now</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="25" name="FSO_Excelsior_Now_3d8f5fa72db44b9fa8f73ae4c775f576_Options">
<vt:lpwstr />
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="26" name="FSO_Table_Segment_Average_Booking_Value_a8480b36b9ea448b81d82f1885690b12_Description">
<vt:lpwstr>Segment Average Booking Value.xml</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="27" name="FSO_Table_Segment_Average_Booking_Value_a8480b36b9ea448b81d82f1885690b12_Data">
<vt:lpwstr>\\?FastStatsBaseDirectory\hols2007\0\Public:\Reportables\Demo\Segment Average Booking Value.xml</vt:lpwstr>
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="28" name="FSO_Table_Segment_Average_Booking_Value_a8480b36b9ea448b81d82f1885690b12_Options">
<vt:lpwstr />
</property>
- <property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="29" name="Solution ID">
<vt:lpwstr>{36eb6792-3a29-43b3-8cd0-f67d266fb426}</vt:lpwstr>
</property>
- <property fmtid="{64440492-4C8B-11D1-8B70-080036B11A03}" pid="4">
<vt:lpwstr>Apteco</vt:lpwstr>
</property>
</Properties>
The properties that have a name that start with FSO_ are actually custom properties that I have set so that I can marry NamedRanges in excel to the actual location on a server where the definition lies. I do not want to lose them if at all possible.
If this file does contain the customisation, can I tell which property elements to remove?
Hope this is clear, thanks for your help so far
SiH
SiH at 2007-10-2 >
