LoginSignup
0
0

【Publisher】Try adding an Excel download icon to a web report

Posted at

Introduction

Sharperlight Publisher is an end-user application designed to facilitate the creation of tables, charts, and visualizations on a web browser based on dynamically extracted data from your preferred data sources.
Today, we will explore how to add an icon for downloading what has been created as a table in a Microsoft Excel file, and also adjusting its size and position.

Creating a Web Report

Launch the Publisher from the Sharperlight application menu.
image.png
Once the Publisher is launched, initiate the creation of a web report by clicking New button.
image.png
First, enter the Code, Group, Title, and Report Title. The combination of Code and Group will serve as a unique identifier for this report.
image.png
Next, create the core query for the report. Launch the Query Builder by clicking on the Edit Query button.
image.png
In the Query Builder, you will utilize an existing database. Sharperlight generally communicates with database through a datamodel, referred to as Product. Here, in the filter area, specify which datamodel to connect to under Product.
image.png
Once the datamodel is specified, you gain access to each table defined within that datamodel. In the Table section of the filter area, choose the table you want to use from the list.
image.png
When the table is specified, the columns belonging to that table and JOIN information will be displayed in a tree format in the selection area.
image.png
You will now select which columns' data to output from the displayed columns in the selection area. Double-click or drag and drop the desired columns to the output area.
image.png
Additionally, you can set filter items by dragging and dropping them into the filter area. For this instance, you specified Order date as the filter.
image.png
The item Total Amount at the bottom of the output area does not exist in the selection area. This is called an Expression, one of the extended options provided by Sharperlight. Here, you are defining an expression Unit Price x Quantity to calculate the total amount.
image.png
Verify the query by clicking the Preview button. If data is displayed, then it is considered successful.
image.png
Return to the query definition screen by clicking the Back to Query button, and then save the query by clicking the OK button.

Next, navigate to the Options tab. Ensure that the Default Type is set to Table.
image.png
Leave the various other options as default and click the OK button to save the web report.
image.png

Launch the Sharperlight Service either from the Sharperlight application menu or through the Windows service dialog.
From the application menu, if available.
image.png
From the Windows Service dialog.
image.png
Return to the Publisher, select the report you created earlier, and execute View Report from the right-click menu.
image.png
The default browser will display a table like this. The columns you set in the filter area of the Query Builder are shown at the top of the report.
image.png
That completes the basic setup for the web report.

Displaying Icons

Now, let's add the Excel download icon. Go back to the Publisher and open the definition of the web report you created earlier. Move to the Options tab, and at the bottom right, check the Icon Excel checkbox to turn it On.
image.png
Save the definition of the web report with the OK button, and refresh the displayed report in the browser with the F5 key. An Excel icon should now appear in the corner. Clicking on it will download the displayed information as an Excel file.
image.png

Decorating the Icon

"But the icon is small; I want it to be bigger." If you think that, you can use CSS for customization. Return to the Publisher, open the definition of the web report again. In the Options tab, about halfway down, turn on the Custom Styles, CSS option.
image.png
Open the editor by clicking on the Edit button, and paste the following CSS syntax. (This is just an example.)

<style type="text/css">
.k-i-excel {
    font-size: 40px;
    margin-right: 50px;
}
</style>

image.png
Save the changes, refresh the report again, and you should see the icon displayed larger as per the custom CSS.
image.png

You can use the browser's developer tools to inspect and find class names or IDs for elements like icons. Then, you can apply custom styles or decorations to enhance their appearance. Keep in mind that in some cases, customization might be limited by the application or platform.
image.png

Conclusion

Web reports created with Sharperlight are essentially standard HTML pages with CSS. As demonstrated, you can customize them freely, adjusting sizes, positions, and more as needed. Feel free to explore and try out different modifications.
Once again, keep in mind that in some cases, customization might be limited by the application or platform.

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0