Excel Formatting: Macro vs XSLT
At work I've run into numerous excel spreadsheets with large macros used to format data. In certain cases, especially when the process is automated, excel will lock up with various errors such as: Exception Code: c0000005
I'm still looking into that error but was wondering if it would be a better idea to use XSL Transformations to do formatting. My questions are:
- How much control can I get 开发者_JS百科over the formatting of the cells using XSLT?
- Is there any performance gain/loss doing it this way?
- Any pros and cons for either option?
I don't have experience using XSLT to format excel sheets.
However, it is better to do the formatting using Excel macros because
The code is written in VB/VBA.
Hence, easy for any developer to pick it up & not to learn a new language (XSLT). And hence, the maintainability.
I disagree with the above speaker. It seems to me that XSLT transformations are simpler to implement and more efficient in terms of performance. I use them frequently.
The only thing you should remember, is that not all formatting options are supported, so you should make a decision based on your business requirements.
The list of unsupported formatting features:
Auditing tracer arrows
Chart and other graphic objects
Chart sheets, macro sheets, dialog sheets
Custom views
Data consolidation references
Drawing object layers
Outlining and grouping features
Password-protected worksheet data
Scenarios
User-defined function categories
VBA projects/macros
精彩评论