0

I have this code that send GridView data to outlook

 Microsoft.Office.Interop.Outlook.Application oApp = new Microsoft.Office.Interop.Outlook.Application();
            Microsoft.Office.Interop.Outlook.MailItem oMsg = (Microsoft.Office.Interop.Outlook.MailItem)oApp.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem);

            string str;
            MemoryStream ms = new MemoryStream();
            try
            {
                gridView2.OptionsPrint.AutoWidth = false;
                gridView2.OptionsPrint.UsePrintStyles = true;
                gridView2.ExportToHtml(ms);
                ms.Seek(0, SeekOrigin.Begin);
                StreamReader sr = new StreamReader(ms);
                str = sr.ReadToEnd();
            }
            finally
            {
                ms.Close();
            }

            oMsg.BodyFormat = Microsoft.Office.Interop.Outlook.OlBodyFormat.olFormatHTML;
            oMsg.Display(false); 
            oMsg.HTMLBody = OrderNumber + str +oMsg.HTMLBody;

the table look like this enter image description here

but i want table style to be like this enter image description here

how can i do that,Thanks in advance

M.Bouabdallah
  • 530
  • 10
  • 29

1 Answers1

0

Set the GridView.AppearancePrint.HeaderPanel.BackColor property to White to change a column header background color.

Refer to the Appearance and Conditional Formatting help article that describes different ways of appearance customizations.

Svetlana
  • 421
  • 3
  • 5
  • thanks for your help,The thing that bothers me most is the style of columns,I want it to be as one body not as separate as it shows – M.Bouabdallah Jun 07 '19 at 11:12
  • If you change the background color as I mentioned, column headers will be shown in the same manner as regular data cells. – Svetlana Jun 10 '19 at 08:46
  • I tried (white and transparent) but I get the same style – M.Bouabdallah Jun 12 '19 at 08:38
  • Column headers of an exported grid become white on my side if the GridView.OptionsPrint.UsePrintStyles option is on and the GridView.AppearancePrint.HeaderPanel.BackColor property is set to White. – Svetlana Jun 13 '19 at 07:39