-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add UserChart / UserQuery widgets to TemplateControls
- Loading branch information
1 parent
e229ecc
commit e8d4ab2
Showing
4 changed files
with
78 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
e8d4ab2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WordTemplate with embedded Excel charts from UserCharts / UserQueries
I've been doing some important improvements in Dashboards recently, but as a friend of mine put it
A little bit of history
A few years ago I implemented a project that required generating PowerPoint reports with embedded Excel charts filled with data from the database.
The implementation was made by generalizing
WordTemplateEntity
to also support PowerPoint files (naming sucks...) and writing the initial code to bind data from UserQueries or UserCharts into the data behind an embedded Excel chart.The code worked for PowerPoint files (pptx) but was never implemented for Word documents (docx).
This week we had a similar problem but this time for docx files, so together with @thomasM1978 we finished this implementation and made some fixes to make it prime-time ready.
How it works
In Excel, fill some dummy data and insert a new chart of the desired type, customize at will.
When ready, select the chart and copy it.
Paste it in your Word / PowerPoint document, no special paste needed. Word will embedd the chart format and the data inside of the docx file itself. No reference to the original excel.
Create a UserQuery or UserChart that is able to produce the data to fill the chart. If you are using a MultiLine/MultiColumns/StackedAreas/etc with an split column... don't worry! the tool is able to pivot the data to fit a usual tabular format with variable number of columns.
Word template UI has two new buttons to add a User Chart or User Query. Click the one for User Chart.
After selecting the user chart, it will show a modal window like this:
Copy the code.
Paste the code in the Alternative Text of your chart, this is how it looks in Office 2013:
Save the docx and upload it to your
WordTemplateEntity
.In the
WordTemplate
, Create a new word report.This should be enough to make the WordTemplate detect the chart and bound the data.
You can fill the data of a chart using a
UserQuery
or aUserChart
, doesn't really matter because only the query definition will be used.The same workflow should work for PowerPoint too.
In PowerPoint you can bind excel tables from a
UserQuery
, but in Word get converted to word tables, so a@foreach
should be used instead.I've added a working example to Southwind Invoice WordTemplate.
Enjoy!
e8d4ab2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e8d4ab2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
such a fantastic features these days! 👏👏👏
Thanks Olmo, Thanks @thomasM1978 🙏🙏
Long live Signum! 🎉🎉