Table functions > Exported file

Crud Elite

Getting Started

Action Column

Hide action column

Add buttons to action column

Table functions

Default sorting

“Show 10 records” drop-down

The “Search…” placeholder

Exported file

Columns ordering

Custom content in a column

Confirm delete popup

Common issues

Edit auratheme.table.js

Other

Clone for another table

How it works

Read data for the table

How to change the exported file's file name?


How can you change the exported file's name? By default, the exported file follows the ViewBag.Title. However, you might want to customize the filename to reflect something more relevant. Here’s how to set a different name for your exported files.

The steps


You can change the data-filename value in /Views/Home/Index.cshtml.

The code in the first image below will name the exported file Client-CurrentDateTime. (You can try in the live demo) Where is the code that sets the CurrentDateTime? You can refer to the second image below. It’s in wwwroot/js/auratheme.table.js.

image.png

image.png

Before removing current date time (original code):

XLSX.writeFile(wb, `${renderTableDiv.getAttribute("data-filename")}-${getCurrentDateTimeForFileName()}.xlsx`);

After removing the current date time from the file name:

XLSX.writeFile(wb, `${renderTableDiv.getAttribute("data-filename")}.xlsx`);