Protecting XML attributes in excel cells

MartyK

New Member
Joined
Apr 8, 2011
Messages
1
Not for [ read < and ] read > - problems with forum rendering tags


Hi,
I have excel 2010 and am building up xml files to read into excel using the xml namespaces urn:schemas-microsoft-com:office:spreadsheet + others.
This gives me an xml doc that can be read into excel.
A typical Cell hold an xml snippet
<CELL><DATA Header="false" Name="Value" ss:Type="String">[Cell][Data ss:Type="String" Name="Value" Header="false"]DataInCell[/Data][/Cell]
If a user types into the cell then the xml becomes
<CELL><DATA Header="false" Name="Value" ss:Type="String">[Cell][Data ss:Type="String" Name="Value" Header="false"]UserText[/Data][/Cell]
which is great
if I copy and paste the text from a source outside of excel however it becomes
<CELL><DATA ss:Type="String">[Cell][Data ss:Type="String"]User Text Pasted[/Data][/Cell]
in otherword the pasting loses my xml attributes in the Data tag.
How can I stop this.
Ideally I wouldnt want to stop the user pasting - I just dont want to lose the attributes
One further problem if I am in excell and copy and paste then I actually overwrite attributes in the destination cell.
so if the source cell had an attribute Name ="Comment" then after the paste the cell would be
<CELL><DATA Header="false" Name="Comment" ss:Type="String">[Cell][Data ss:Type="String" Name="Comment" Header="false"]user Text Pasted From Comment[/Data][/Cell]
Any Ideas?
Thanks
Marty
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

Forum statistics

Threads
1,224,559
Messages
6,179,517
Members
452,921
Latest member
BBQKING

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top