Fonts using Python

I’m wondering if there is any way to set task fonts and/or view fonts using Aspose For Python via .NET.

Could you please describe the scenario in more detail? Which fonts would you like to customize?
Screenshots would be greatly appreciated.

image.png (6.1 KB)

When selecting a task in Project Desktop Application, the font is customizable for the selected task. I don’t see any documentation for changing task fonts using Python via .NET but I am wondering if there’s anything I might have missed.

@dowbuiltNate , the following snippet can used to add task-specific TableTextStyle to Gantt Chart View.

Suppose ‘input.mpp’ file contains at least 1 task and have a view “Gantt Chart”.

from aspose.pycore import cast
import aspose.tasks as tsk
import aspose.tasks.visualization as visualization
import aspose.pydrawing as drawing

l = tsk.License();
l.set_license("license.lic")
# Open existing project
import aspose.tasks as tsk

project = tsk.Project('input.mpp')
view = project.views.get_by_name("&Gantt Chart")
ganttChartView = tsk.GanttChartView()
ganttChartView = cast(tsk.GanttChartView, view)

# get first visible task
task = project.root_task.children.get_by_id(1)

font = visualization.FontDescriptor("Bauhaus 93", 16.0, visualization.FontStyles.BOLD)
# task's 'Unique ID' should be passed to TableTextStyle
tableTextStyle = visualization.TableTextStyle(task.uid, font);
tableTextStyle.background_color = drawing.Color.blue
tableTextStyle.color = drawing.Color.red
from aspose.pycore import cast
import aspose.tasks as tsk
import aspose.tasks.visualization as visualization
import aspose.pydrawing as drawing

l = tsk.License();
l.set_license("license.lic")
# Open existing project
import aspose.tasks as tsk

project = tsk.Project('input.mpp')
view = project.views.get_by_name("&Gantt Chart")
ganttChartView = tsk.GanttChartView()
ganttChartView = cast(tsk.GanttChartView, view)

# get first visible task
task = project.root_task.children.get_by_id(1)

font = visualization.FontDescriptor("Bauhaus 93", 16.0, visualization.FontStyles.BOLD)
# task's 'Unique ID' should be passed to TableTextStyle
tableTextStyle = visualization.TableTextStyle(task.uid, font);
tableTextStyle.background_color = drawing.Color.blue
tableTextStyle.color = drawing.Color.red
# field property can be set to define cell-specific style for the specified column
#tableTextStyle.field = tsk.Field.TASK_NAME
ganttChartView.table_text_styles.clear()
ganttChartView.table_text_styles.insert(1, tableTextStyle)

saveOptions = tsk.saving.MPPSaveOptions()
saveOptions.write_view_data = True

project.save('output.mpp', saveOptions)
ganttChartView.table_text_styles.clear()
ganttChartView.table_text_styles.insert(1, tableTextStyle)

saveOptions = tsk.saving.MPPSaveOptions()
saveOptions.write_view_data = True

project.save('output.mpp', saveOptions)