Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
751 views
in Technique[技术] by (71.8m points)

reporting services - ssrs report export to excel (formulas)

I have an ssrs report that sums a column for a total, like so:

=Sum(CDEC(Fields!Month01Balance.Value))

Now, when exporting to excel this does not export as a formula. I was told there is a way to do it using the ReportFields collection, however I cannot get that to work. Does anyone know of a way I can get a total column to export a formula to excel? I don't know how many rows there will be so I cannot manually reference each ReportField text box.

Thanks for any pointers here!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You must replace the VALUE of the cell with text representing the formula, but the formula must be preceded by a single apostrophe: e.g.,

A | B | C

2 | 4 | 6

Becomes:

A | B | C

2 | 4 | '=A1+B1

When you export the report to Excel, replace all the single apostrophes with [nothing]. The formulas should now run.

Suggestion: Create a new boolean report parameter called "Show_Formulas." Then, write an expression for field C: =IIF(Parameters!ShowFormulas.Value,"'=A" & RowNumber("myQuery") & "+B" & RowNumber("myQuery"),Fields!C.Value)

This way, the enduser can either see the values in the report, or re-run the report showing the formulas for export.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...