17
Views
3
Comments
[MSWordUtils] MS Word Utils -Fomatting text in paragraph
mswordutils
Web icon
Forge asset by Stuart Harris
Application Type
Traditional Web, Reactive

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())

2025-03-12 07-08-15
Nilesh Trivedi

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"

        ) +

        MSWord_MakeText(

            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.

UserImage.jpg
Salini Gupta

No it didnt worked ...getting error. SS attached 

2025-07-22 10-30-27
Mandar Deshpande

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.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.