Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEAT-633] ☺ Styling Excel, dump space not prefix #842

Merged
merged 5 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions cognite/neat/_rules/exporters/_rules2excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _write_sheets(

main_header = self._main_header_by_sheet_name[sheet_name]
sheet.append([main_header] + [""] * (len(headers) - 1))
sheet.merge_cells(start_row=1, start_column=1, end_row=1, end_column=len(headers))

if headers[0] == "Neat ID":
# Move the Neat ID to the end of the columns
headers = headers[1:] + ["Neat ID"]
Expand Down Expand Up @@ -157,12 +157,13 @@ def _write_sheets(
# This freezes all rows above the given row
sheet.freeze_panes = sheet["A3"]

sheet["A1"].alignment = Alignment(horizontal="center")
sheet["A1"].alignment = Alignment(horizontal="left")

if self._styling_level > 1:
# Make the header row bold, larger, and colored
sheet["A1"].font = Font(bold=True, size=20)
sheet["A1"].fill = PatternFill(fgColor="FFC000", patternType="solid")
for cell, *_ in sheet.iter_cols(min_row=1, max_row=1, min_col=1, max_col=len(headers)):
cell.font = Font(bold=True, size=20)
cell.fill = PatternFill(fgColor="FFC000", patternType="solid")
for cell in sheet["2"]:
cell.font = Font(bold=True, size=14)

Expand Down
2 changes: 1 addition & 1 deletion cognite/neat/_rules/models/_base_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class BaseMetadata(SchemaModel):

role: ClassVar[RoleTypes] = Field(description="Role of the person creating the data model")
aspect: ClassVar[DataModelAspect] = Field(description="Aspect of the data model")
space: SpaceType = Field(alias="prefix", description="The space where the data model is defined")
space: SpaceType = Field(description="The space where the data model is defined")
external_id: DataModelExternalIdType = Field(
alias="externalId", description="External identifier for the data model"
)
Expand Down
2 changes: 1 addition & 1 deletion cognite/neat/_session/_to.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def excel(
neat.to.excel(information_rules_file_name, model="dms")
```
"""
exporter = exporters.ExcelExporter()
exporter = exporters.ExcelExporter(styling="maximal")
rules: VerifiedRules
if model == "information" or model == "logical":
rules = self._state.data_model.last_verified_information_rules[1]
Expand Down
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Changes are grouped as follows:
creating the instances in CDF.
- Implementing a view with a reverse connection and not overwriting reverse connection from the parent,
no longer returns a `ReversedConnectionNotFeasibleError` in `neat.verify()`.
- Dumping any data model in neat now uses `space` and not `prefix` in the Metadata sheet.

## [0.102.0] - 09-12-**2024**
### Fixed
Expand Down
Loading