• Michael Intravartolo

Export To Excel With Font Color



Hi All,

In this article we will discuss how to achieve Export To Excel with Font, Color and Background color.

Let's begin.

1. Add four fields: Custom Font Name, Custom Font Size, Custom Font Color and Custom Background Color in Excel Buffer table as shown below.


2. Create copy of two standard functions - AddColumn & GetCellDecorator with new name:

>AddColumnWithFonts

>GetCellDecoratorWithFonts

3. Below are changes in AddColumnWithFonts -

> Four New Parameter added FontName, FontSize, FontColor, BGColor.

> Assigned these parameter in the table fields created in Step 1, as shown below.


4. Below are changes in GetCellDecoratorWithFonts -

>Remove all Exit, not to get return from function as shown below.


>Added New Code for Font & Color as below.


5. Now let's change the calling of Decorator Function in Excel Buffer Table. The Function is called in Two Functions listed below -

>WriteCellValue

>WriteCellFormula

Chnage the formula as below -

//GetCellDecorator(Bold,Italic,Underline,Decorator); GetCellDecoratorWithFonts(Bold,Italic,Underline,Decorator,"Custom Font Name","Custom Font Size","Custom Font Color","Custom Background Color");


6. Let's test with a report for creating a report with Customer Table.

7. While exporting data we use AddColumn Function of Excel Buffer Table, now with the extension code that we have discussed we can use both the function i.e. AddColumn and AddColumnWithFonts

8. Below is a sample code for Exporting Customer Data


As we can see above we are using both standard and customized Function. The customized Function AddColmnWithFonts are being used with different parameter and options.

9. Let's try to execute the Report and See Output.


Hope you find this article useful.

You can download the sample discussed above from my SkyDrive.

File Name - Saurav-NAV.17.10.ExcelFont.rar

#microsoftdynamicsnav

18 views
Contact Us

Solution Systems, Inc.

3201 Tollview Dr. 

Rolling Meadows, IL 60008

Office: 847-590-3000

Email: info@solsyst.com

Support: 224-345-2020

Support Email: support@solsyst.com

Join our Mailing List
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Illinois
  • Manufacturing Software | Chicago
  • Manufacturing Software | Illinois
  • Microsoft Business Podcast
  • Manufacturing Software | Chicago
  • Manufacturing Software | Chicago
  • Manufacturing Software | Chicago