I am using MS word utils forge component and in that I have used MSWord_MakeParagraph to fetch data from database abut now I want to give color to one text that I am unable to give.
Though its coming but at the bottom of the word file not within the paragaraph.
MSWord_MakeParagraph( MSWord_InsertFormattedText( MSWord_CreateDocument.OutDocument, MSWord_MakeText( GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.ProjectName + " | " + GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.CompanyName, Color: "#4C3794" ) ) + NewLine() + TextToDate(GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.StartDate) + " – " + TextToDate(GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.EndDate) + NewLine() + "Skills:" + GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.Skills + NewLine() + "Description:" + NewLine() + GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.Description+NewLine())
Hi @Salini Gupta,
The issue you're experiencing is because MSWord_MakeText creates a separate text element rather than applying color to text within a paragraph.
MSWord_MakeParagraph(
MSWord_InsertFormattedText(
MSWord_CreateDocument.OutDocument,
MSWord_MakeText(
GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.ProjectName + " | " +
GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.CompanyName,
Color: "#4C3794"
) +
NewLine() +
TextToDate(GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.StartDate) +
" – " +
TextToDate(GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.EndDate) +
NewLine() + "Skills:" +
GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.Skills +
NewLine() + "Description:" + NewLine() +
GetEmployeeProjectsByEmployeeId.List.Current.EmployeeProject.Description +
NewLine()
)
Hope it helps.
Thank You.
No it didnt worked ...getting error. SS attached
Hi @Salini Gupta
MSWord_MakeText() and MSWord_MakeFormattedText() both return MSWord_Text objects but when you try to concatenate with +, Outsystems converts it to normal Text string which breaks the type.
You can try using MSWord_ConcatText() to join multiple text parts.