Commit graph

51 commits

Author SHA1 Message Date
Abdeali Chharchhodawala
690826ff9b
feat!: faster generation and formatting utils for excel exports (#36323)
* feat: Style builder for report xlsx formatting

* fix: update report to use direct import for query report execution

* refactor: simplify module method retrieval in report execution

* feat: get xlsx styles for report

* refactor: enhance XLSXStyleBuilder with currency formatting and default style registration

* feat: add xlsxwriter dependency for enhanced XLSX report generation

* refactor: enhance XLSXStyleBuilder with improved style registration and formatting methods

* feat: enhance XLSX export functionality with improved styling and metadata support

* refactor: default formatting of currency

* chore: remove some typo

* feat: update make_xlsx function to use xlsxwriter for improved Excel file generation and styling

* perf: some micro optimisations

* refactor: inline generator back and improve condition

* refactor: replace frappe.request_cache with functools.cache

* fix: handle styling in email

* fix: fix old test case to handle styles in export

* refactor: enhance XLSX style handling and registration methods

* refactor: improve currency formatting logic

* fix: update make_xlsx to use constant_memory for large datasets and improve row style handling

* fix: handle None style_id in XLSXStyleBuilder methods to prevent errors

* fix: include owner field with proper doctype naming

* fix: set default date format in XLSX workbook creation

* fix: pass applied filters to metadata

* fix: getting accurate field info for report view exporting

* chore: Minor changes

* feat: add function to generate default XLSX styles for exports

* feat: integrate default XLSX styles into builder report export functionality

* feat: styles on export docs xlsx

* feat: enhance make_xlsx function to support file path saving

* feat: add make_xls function for creating Excel files in old format and improve sheet name sanitization

* fix: handle default date formatting

* refactor: changes xlsx builder usage

* refactor: update xlsx style builder usage

* refactor: enhance field info retrieval with default field support

* fix: handle update key in report data

* refactor: enhance get_field_info to include options and improve label retrieval

* fix: improve error handling for unsupported file formats and ensure applied filters are set correctly

* refactor: update XLSX header index handling and improve metadata structure

* fix: handle currency formatting in reportview export

* fix: update default date format to datetime format in XLSX creation

* fix: update serial number field in auto email report to use 'sr' instead of 'idx'

* fix: enhance XLSX styling by adding right alignment for specific field types

* chore: remove unused code

* fix: update XLSXMetadata attributes for improved report styling options

* perf: further improve currency styling

* fix: correct column index mapping in XLSX export header

* refactor: optimize indentation style registration in XLSXStyleBuilder

* perf: improve apply_indentations

* fix: reduce more attr lookup

* refactor: remove duplication

* fix: use report name in XLSX export instead of hardcoded title

* fix: remove ignore_visible_idx from XLSXMetadata

* fix: review

* fix: update XLSX style fetching logic in build_xlsx_data function

* fix: add right alignment to date, time, and datetime styles in XLSXStyleBuilder

* fix: simplify number format handling in XLSXStyleBuilder

* fix: register common styles in XLSXStyleBuilder for improved style management

* test: add tests for XLSX styles structure and fieldtype column styles in XLSXStyleBuilder

---------

Co-authored-by: Sagar Vora <16315650+sagarvora@users.noreply.github.com>
2026-04-21 19:07:43 +05:30
Sagar Vora
6dfabf9912 perf: reduce frappe.as_unicode calls and use str.replace 2026-01-26 13:46:20 +05:30
Abdeali Chharchhodawala
4647986aeb
fix!: Always Bold report header row (#34703)
* fix: Always bold report header row

* fix: update test cases

* refactor: add option to bold filter rows in XLSX output

* chore: minor changes

* chore: rename index variable

* revert: undo bold filters param use

* refactor: remove duplication for building xlsx data

* revert: add has_filters parameter to check for filter row bold

* refactor: add type hints and docstrings for XLSX data handling functions
2025-12-11 15:55:51 +05:30
Ejaaz Khan
50ff20a12a refactor: only replace month for compatibility 2025-08-06 11:11:24 +05:30
Ejaaz Khan
6cde9a4bcc refactor: fetch time format dynamic 2025-08-05 17:30:14 +05:30
Ejaaz Khan
0e880ac318 feat: format date and datetime fields on export 2025-08-05 17:07:47 +05:30
rehansari26
8dc96658cf chore: format code using pre-commit 2025-04-16 15:22:43 +05:30
rehansari26
a0991b62a3 fix: illegal characters in excel export 2025-04-16 15:17:35 +05:30
Sumit Bhanushali
1c35f2216f fix(XLSX): remove unsupported characters from sheet title 2024-08-05 18:01:30 +05:30
Akhil Narang
af5af9b7a1
chore(openpyxl): don't set read_only=True while reading an excel file
The way openpyxl parses files is very different, and read only seems to break with certain files
It tries to head information about the max rows/columns from the header in the case of read only
which can be wrong sometimes.

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
2024-05-08 11:42:07 +05:30
barredterra
88c8baa9ee refactor: for append to extend, merge list extend
Replace a for append loop with list extend.
Create the list with values instead of creating
an empty list and extending it with another list.
2023-08-09 13:25:39 +02:00
barredterra
b553ed98d8 refactor: inline immediately returned variable
Inline a variable to a return in the case when the
variable being declared is immediately returned
2023-08-08 18:09:49 +02:00
barredterra
433b285b92 refactor: use provide_binary_file 2022-11-26 20:08:50 +01:00
Suraj Shetty
d4166dbe20 refactor: Replace html2text with markdownify 2022-07-06 08:23:14 +05:30
Gavin D'souza
b696fa6da5 perf: Pre-compile and re-use regexp pattern
Converted all possible usages of re.* that weren't compiling the regex
separately and re-using it. Separated out the compiled patterns as
global variables. Repetitive patterns could be made DRY-er.

Would be nicer to have all regexes in a single module so that we could
re-use better, keep track of outdated, and keep checks for possible
reDos' etc
2022-06-08 14:07:38 +05:30
Suraj Shetty
c0c5b2ebdd
style: format all python files using black (#16453)
Co-authored-by: Frappe Bot <developers@frappe.io>
2022-04-12 10:59:25 +05:30
Ankush Menat
eda052529b
fix: calling non-exisitng unescape method on HTML2Text (#15796)
test: xlsxutils
2022-01-30 12:17:02 +05:30
Gavin D'souza
3446026555 chore: Update header: license.txt => LICENSE
The license.txt file has been replaced with LICENSE for quite a while
now. INAL but it didn't seem accurate to say "hey, checkout license.txt
although there's no such file". Apart from this, there were
inconsistencies in the headers altogether...this change brings
consistency.
2021-09-03 12:02:59 +05:30
Rohan Bansal
86851028ea feat: manage Python 3 compatiblity with dependencies 2021-04-14 14:40:58 +05:30
Suraj Shetty
f1cb8f4e5c feat: Pass custom widths for excel columns 2020-10-16 13:42:00 +05:30
Faris Ansari
d2fe007177 fix(xls): Don't remove first row 2019-09-29 22:41:30 +05:30
Faris Ansari
d07ac06e5c fix: Export to Excel 2019-09-29 22:41:29 +05:30
Faris Ansari
07eedad5bb fix: Parse .xls and .xlsx files in import 2019-09-29 22:41:29 +05:30
Faris Ansari
2677e54e9d fix(xlsx): Fix for handle failed html parse 2019-04-11 14:54:42 +05:30
Frappe Bot
94ea028db3 Merge branch 'master' into develop 2019-03-08 09:38:18 +00:00
Rushabh Mehta
9df07891ff fix(xmlx): handle unparseable HTML 2019-03-06 16:11:06 +05:30
Sagar Vora
ef82f39f99 Merge branch 'staging' into develop 2019-01-29 18:24:11 +05:30
Aditya Hase
6b72faf44f style: Linting fixes (#6809)
* style: Remove unused imports

* style: Remove unused local variables
2019-01-23 16:39:55 +05:30
RA-dim
144d6f8cc2 fix[Data Import]: "Not found" error on recently uploaded XLSX file. (#6510) 2018-11-22 09:42:46 +05:30
Frappe Bot
478e60fdb1 Merge branch 'staging' into develop 2018-11-09 10:18:33 +00:00
Frappe Bot
c373a172af Merge branch 'master' into staging-fixes 2018-11-09 10:08:19 +00:00
gshmu
a2642868a5 fix read_xlsx_file_from_attached_file when xlsx contain functions (#6400) 2018-11-09 10:53:03 +05:30
Chinmay Pai
8943f6cfd5
file-api: migration improvements and fixes
* migrate more functions to file class
* add get_content(), returns file content from file_name
* move get_file_path() to get_full_path() to decrease naming ambiguity

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-09-06 17:30:33 +05:30
Chinmay Pai
22ba310aaf
[2/3] file-api: code migration
migrate api from file_manager.py to file.py

Signed-off-by: Chinmay Pai <chinmaydpai@gmail.com>
2018-09-03 18:04:45 +05:30
rohitwaghchaure
a5d7182817 [Fix] Ascii code issue while downloading report (#5990) 2018-08-21 11:21:40 +05:30
Faris Ansari
217156e5fa
Add filepath param in read_xlsx (#5465) 2018-04-18 16:38:57 +05:30
Suraj Shetty
436d7a0d4e Data export tool (#5213)
* Data export tool
New doctype to export data
Child table export option
Ability to add filter

* Filter view refactor
Separated filter css

* Moved exporter script from data import doctype to data export doctype

* some input validation

* removed unwanted file and some style fixes

* removed console log

* hide sidebar

* renamed export method

* added data export link in setup module page

* minor fix

* refactor exporter.py

* data export ui tweaks

* codacy and bug fix

* silly code fixes

* [minor] indentation fix
2018-03-22 11:30:48 +05:30
Achilles Rasquinha
611a74445e fixed bytesio object generation for python 2 and 3 for excel, wtf email 2018-03-20 01:07:17 +05:30
Prateeksha Singh
ae0234e7e6 [export-fields] export comma separated lines for long values (#4667)
* [export-fields] export comma separated lines for long values, fixes frappe/erpnext#12085

* Update xlsxutils.py
2017-12-22 11:11:13 +05:30
Rohit Waghchaure
f8928dc999 [fix] Not able to export general ledger report's data if data has illegal characters 2017-11-03 15:01:42 +05:30
Saurabh
133df77d31 [fix] revert unicode dencoding 2017-11-03 11:47:39 +05:30
Rohit Waghchaure
05808554a0 [fix] Not able to export general ledger report's data in excel 2017-10-30 13:42:49 +05:30
Ben Cornwell-Mott
0bc85c7431 Allow workbook pass in make_xlsx 2017-09-23 15:32:06 -07:00
Aditya Hase
769338f136 Replaced all instances of basestring with six.string_types 2017-08-11 00:10:11 +05:30
Aditya Hase
d3395dfd28 Replaced StringIO and cStringIO imports with six.StringIO (#3810)
StringIO and cStringIO modules are replaced with io.StringIO in
Python 3. six.StringIO is an alias for StringIO.StringIO in
Python 2 and io.StringIO in Python 3
2017-07-31 10:54:17 +05:30
Faris Ansari
f16854559d [minor] Handle string with no html tag in xlsxutils (#3332) 2017-05-18 13:39:07 +05:30
Manas Solanki
5315bea77f Data Import Tool in excel file format (#3231)
* Data Import in excel file format

* Include test case and minor fixes

* typos
2017-05-18 11:40:44 +05:30
Manas Solanki
bfb181333c handle the escape sequence in the html2text library (#3272) 2017-05-12 15:23:11 +05:30
mbauskar
3319257d0f [fixed] error while exporting the report in excel format 2017-05-02 14:05:39 +05:30
OlaAkeela
512bcd39d5 remove html tags when exporting report in excel format (#3174)
* remove html tags when exporting report in excel format

* remove html tags when export report as excel using html2text
2017-05-01 12:17:15 +05:30