Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jean-Marie Place
SCODOC_R6A06
Commits
8ddab219
Commit
8ddab219
authored
5 months ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
Fix: export excel avec caractères invalides
parent
845b0e93
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/scodoc/sco_excel.py
+13
-2
13 additions, 2 deletions
app/scodoc/sco_excel.py
sco_version.py
+1
-1
1 addition, 1 deletion
sco_version.py
with
14 additions
and
3 deletions
app/scodoc/sco_excel.py
+
13
−
2
View file @
8ddab219
...
@@ -40,7 +40,9 @@ from openpyxl.styles.numbers import FORMAT_NUMBER_00, FORMAT_GENERAL, FORMAT_DAT
...
@@ -40,7 +40,9 @@ from openpyxl.styles.numbers import FORMAT_NUMBER_00, FORMAT_GENERAL, FORMAT_DAT
from
openpyxl.comments
import
Comment
from
openpyxl.comments
import
Comment
from
openpyxl
import
Workbook
,
load_workbook
from
openpyxl
import
Workbook
,
load_workbook
from
openpyxl.cell
import
WriteOnlyCell
from
openpyxl.cell
import
WriteOnlyCell
from
openpyxl.cell.cell
import
ILLEGAL_CHARACTERS_RE
from
openpyxl.styles
import
Font
,
Border
,
Side
,
Alignment
,
PatternFill
from
openpyxl.styles
import
Font
,
Border
,
Side
,
Alignment
,
PatternFill
from
openpyxl.utils.exceptions
import
IllegalCharacterError
from
openpyxl.worksheet.worksheet
import
Worksheet
from
openpyxl.worksheet.worksheet
import
Worksheet
import
app.scodoc.sco_utils
as
scu
import
app.scodoc.sco_utils
as
scu
...
@@ -366,8 +368,17 @@ class ScoExcelSheet:
...
@@ -366,8 +368,17 @@ class ScoExcelSheet:
value
=
value
.
replace
(
tzinfo
=
None
)
value
=
value
.
replace
(
tzinfo
=
None
)
# création de la cellule
# création de la cellule
try
:
cell
=
WriteOnlyCell
(
self
.
ws
,
value
)
cell
=
WriteOnlyCell
(
self
.
ws
,
value
)
except
IllegalCharacterError
as
exc
:
if
isinstance
(
value
,
str
):
# chaine contenant un caractère interdit dans Excel: élimine
value
=
ILLEGAL_CHARACTERS_RE
.
sub
(
""
,
value
)
cell
=
WriteOnlyCell
(
self
.
ws
,
value
)
else
:
raise
ScoValueError
(
f
"
Valeur de cellule non autorisée:
{
value
}
"
)
from
exc
# recopie des styles
# recopie des styles
if
style
is
None
:
if
style
is
None
:
style
=
self
.
default_style
style
=
self
.
default_style
...
...
This diff is collapsed.
Click to expand it.
sco_version.py
+
1
−
1
View file @
8ddab219
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
"
Infos sur version ScoDoc
"
"
Infos sur version ScoDoc
"
SCOVERSION
=
"
9.7.6
3
"
SCOVERSION
=
"
9.7.6
4
"
SCONAME
=
"
ScoDoc
"
SCONAME
=
"
ScoDoc
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment