<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Colored rows while Export to Excel in SAPUI5 in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443296#M64535</link>
    <description>&lt;P&gt;Hi &lt;A href="https://answers.sap.com/users/124599/saurabhmathur4.html"&gt;Saurabh Mathur&lt;/A&gt;, &lt;/P&gt;
  &lt;P&gt;You can use javascript to download html table to excel , check out this link : &lt;A href="https://stackoverflow.com/questions/22317951/export-html-table-data-to-excel-using-javascript-jquery-is-not-working-properl" target="test_blank"&gt;https://stackoverflow.com/questions/22317951/export-html-table-data-to-excel-using-javascript-jquery-is-not-working-properl&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;So before downloading just provide the inline styling to the HTML to get styling the export excel &lt;/P&gt;
  &lt;P&gt;thanks&lt;/P&gt;
  &lt;P&gt;Viplove &lt;/P&gt;</description>
    <pubDate>Wed, 12 Jul 2017 09:33:51 GMT</pubDate>
    <dc:creator>former_member340030</dc:creator>
    <dc:date>2017-07-12T09:33:51Z</dc:date>
    <item>
      <title>Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaq-p/443289</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I created Export to Excel functionality as mentioned in below SAPUI5 Explored functionality - &lt;/P&gt;&lt;P&gt;&lt;A href="https://sapui5.hana.ondemand.com/1.38.5/explored.html#/sample/sap.m.sample.TableExport/preview" target="test_blank"&gt;https://sapui5.hana.ondemand.com/1.38.5/explored.html#/sample/sap.m.sample.TableExport/preview&lt;/A&gt;&lt;/P&gt;&lt;P&gt;But I need to add background color for some of the excel cells, like table headings and some text. Any pointers on how to achieve this?&lt;/P&gt;&lt;P&gt;I referred some blogs as well but it didn't work - &lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2014/11/20/exporting-to-excel-from-sapmtable/" target="test_blank"&gt;https://blogs.sap.com/2014/11/20/exporting-to-excel-from-sapmtable/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2014/01/07/export-sapuitabletable-as-csv/" target="test_blank"&gt;https://blogs.sap.com/2014/01/07/export-sapuitabletable-as-csv/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sap.com/2015/04/07/export-to-excel-customization-in-ui5/" target="test_blank"&gt;https://blogs.sap.com/2015/04/07/export-to-excel-customization-in-ui5/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Any kind of help will be highly appreciated.&lt;/P&gt;&lt;P&gt;Thanks &amp;amp; Regards,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 00:21:49 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaq-p/443289</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-07-06T00:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443290#M64529</link>
      <description>&lt;P&gt;Hi , &lt;/P&gt;&lt;P&gt;You need to provide inline styling(background color) to the sap.m.table row to get the same styling in excel .. &lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Viplove&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 07:41:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443290#M64529</guid>
      <dc:creator>former_member340030</dc:creator>
      <dc:date>2017-07-06T07:41:29Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443291#M64530</link>
      <description>&lt;P&gt;Thanks Viplove for the suggestion. &lt;/P&gt;&lt;P&gt;I am using XML view and sap.ui.table and want column headers (which are labels) with different color. I tried below inline styling but it did not work.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;Column id="col1"&amp;gt;
    &amp;lt;m:Label text="Company" style="background-color:#ffcc00"/&amp;gt;
    &amp;lt;template&amp;gt;
         &amp;lt;m:Text text="{Company}"/&amp;gt;
    &amp;lt;/template&amp;gt;
&amp;lt;/Column&amp;gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Apart from table data, I am appending some custom text as well in the excel sheet (stored as a variable) which needs to be highlighted, any idea on that?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;</description>
      <pubDate>Thu, 06 Jul 2017 20:17:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443291#M64530</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-07-06T20:17:04Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443292#M64531</link>
      <description>&lt;P&gt;Hi Saurabh,&lt;/P&gt;&lt;P&gt;First of all there is no property known as style in SAP controls (Label) so style="background-color:#ffcc00" is wrong .. you need to do it through JavaScript in controller by getting the DOM element and add the style by changing the style property before download to excel ..&lt;/P&gt;&lt;P&gt;If you check the HTML rendering of the sap.m.table in developer options of chrome it will be a HTML table tag with td and th tags ... so you need to manipulate those using javascript for adding inline styles and also for adding new content you can add in the HTML of download content with style class to hide the text on the screen but it will come in download as the class styling will not have any affect on the excel download only inline has affect.. &lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Viplove&lt;/P&gt;</description>
      <pubDate>Fri, 07 Jul 2017 13:05:20 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443292#M64531</guid>
      <dc:creator>former_member340030</dc:creator>
      <dc:date>2017-07-07T13:05:20Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443293#M64532</link>
      <description>&lt;P&gt;Hi Viplove,&lt;/P&gt;&lt;P&gt;Let's say I want to achieve above requirement for below table.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&amp;lt;m:Table id="testTable"&amp;gt;
	&amp;lt;m:columns&amp;gt;
		&amp;lt;m:Column id="productCol" &amp;gt;&amp;lt;m:Text text="Product" /&amp;gt;&amp;lt;/m:Column&amp;gt;
		&amp;lt;m:Column id="supplierCol"&amp;gt;&amp;lt;m:Text text="Supplier" /&amp;gt;&amp;lt;/m:Column&amp;gt;
		&amp;lt;m:Column id="priceCol" &amp;gt;&amp;lt;m:Text text="Price" /&amp;gt;&amp;lt;/m:Column&amp;gt;
	&amp;lt;/m:columns&amp;gt;
	&amp;lt;m:items&amp;gt;
		&amp;lt;m:ColumnListItem&amp;gt;
			&amp;lt;m:cells&amp;gt;
				...
			&amp;lt;/m:cells&amp;gt;
		&amp;lt;/m:ColumnListItem&amp;gt;
	&amp;lt;/m:items&amp;gt;
&amp;lt;/m:Table&amp;gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And below is call from controller.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;var prd= document.getElementById("__xmlview0--testTable-tblHead0"); // DOM element ID for 'Product' column which needs to be highlighted, which is a &amp;lt;th&amp;gt;


// Inline styling of 'Product' column
prd.setAttribute("style", "background-color: #ffcc00;");

// Creating Export object
var oExport = new sap.ui.core.util.Export({ 
	exportType : new sap.ui.core.util.ExportTypeCSV({
		separatorChar : ","
	}),
	
	models : oTable.getModel(),

	rows : {
		path : "/"
	},

	columns : [{
		name : "Product",
		template : {
			content : "{Product}"
		}
	}, {
		name : "Supplier",
		template : {
			content : "{Supplier}"
		}
	},  {
		name : "Price",
		template : {
			content : "{Price}"
		}
	}]
});

oExport.saveFile("Report").catch(function(oError) {
     MessageBox.error("Error when downloading data.\n\n" + oError);
}).then(function() {
   oExport.destroy();
});&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Looks like there is a disconnect between DOM element and export object? How this element can bind to the export object?&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Can you have a look and suggest?&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Saurabh&lt;/P&gt;</description>
      <pubDate>Sat, 08 Jul 2017 00:43:26 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443293#M64532</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-07-08T00:43:26Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443294#M64533</link>
      <description>&lt;P&gt;Hi , &lt;/P&gt;&lt;P&gt;Actually you are downloading through model data not the html table which is rendered on the screen , so the way i told you in above comments and answers will not help you .. And also one more thing the way you are exporting will not give the data in table format it will be much more like comma (,) separated values ..&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;Viplove .. &lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2017 09:27:42 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443294#M64533</guid>
      <dc:creator>former_member340030</dc:creator>
      <dc:date>2017-07-10T09:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443295#M64534</link>
      <description>&lt;P&gt;Thanks Viplove for the inputs. &lt;/P&gt;
  &lt;P&gt;I also followed &lt;A target="_blank" href="https://blogs.sap.com/2014/11/20/exporting-to-excel-from-sapmtable/"&gt;this blog&lt;/A&gt; and tried to go with a different approach but that also did not help. &lt;/P&gt;
  &lt;P&gt;Do you have any reference or working example on this? That will be of great help.&lt;/P&gt;
  &lt;P&gt;Thanks,&lt;/P&gt;
  &lt;P&gt;Saurabh&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2017 00:15:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443295#M64534</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-07-11T00:15:29Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443296#M64535</link>
      <description>&lt;P&gt;Hi &lt;A href="https://answers.sap.com/users/124599/saurabhmathur4.html"&gt;Saurabh Mathur&lt;/A&gt;, &lt;/P&gt;
  &lt;P&gt;You can use javascript to download html table to excel , check out this link : &lt;A href="https://stackoverflow.com/questions/22317951/export-html-table-data-to-excel-using-javascript-jquery-is-not-working-properl" target="test_blank"&gt;https://stackoverflow.com/questions/22317951/export-html-table-data-to-excel-using-javascript-jquery-is-not-working-properl&lt;/A&gt;&lt;/P&gt;
  &lt;P&gt;So before downloading just provide the inline styling to the HTML to get styling the export excel &lt;/P&gt;
  &lt;P&gt;thanks&lt;/P&gt;
  &lt;P&gt;Viplove &lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 09:33:51 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443296#M64535</guid>
      <dc:creator>former_member340030</dc:creator>
      <dc:date>2017-07-12T09:33:51Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443297#M64536</link>
      <description>&lt;P&gt;Yes, even I referred this and trying to implement my requirements. &lt;/P&gt;
  &lt;P&gt;This is doing the trick but throwing file format issues while opening the excel.&lt;/P&gt;
  &lt;P&gt;&lt;IMG class="migrated-image" src="https://community.sap.com/legacyfs/online/storage/attachments/storage/7/attachments/49418-excel-issue.jpg" /&gt;&lt;/P&gt;
  &lt;P&gt;But once I open the excel, I can see my content in desired way.&lt;/P&gt;
  &lt;P&gt;Thanks,&lt;/P&gt;
  &lt;P&gt;Saurabh&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jul 2017 00:51:27 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443297#M64536</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-07-13T00:51:27Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443298#M64537</link>
      <description>&lt;P&gt;Use can use addStyleclass() on the control as we&lt;/P&gt;</description>
      <pubDate>Sat, 15 Jul 2017 02:31:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443298#M64537</guid>
      <dc:creator>devendervb</dc:creator>
      <dc:date>2017-07-15T02:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443299#M64538</link>
      <description>&lt;P&gt;Hi Devender,&lt;/P&gt;
  &lt;P&gt;Method addStyleClass() did not work in excel. It worked on-screen though.&lt;/P&gt;
  &lt;P&gt;Thanks,&lt;/P&gt;
  &lt;P&gt;Saurabh&lt;/P&gt;</description>
      <pubDate>Sun, 16 Jul 2017 08:19:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443299#M64538</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2017-07-16T08:19:00Z</dc:date>
    </item>
    <item>
      <title>Re: Colored rows while Export to Excel in SAPUI5</title>
      <link>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443300#M64539</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
  &lt;P&gt;&lt;/P&gt;
  &lt;P&gt;Could you please let me know what is the solution to make rows to bold and highlight the background color to blue only for the rows.&lt;/P&gt;
  &lt;P&gt;Very much urgent.&lt;/P&gt;
  &lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Wed, 05 Sep 2018 13:30:33 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/colored-rows-while-export-to-excel-in-sapui5/qaa-p/443300#M64539</guid>
      <dc:creator>sankar_narayana</dc:creator>
      <dc:date>2018-09-05T13:30:33Z</dc:date>
    </item>
  </channel>
</rss>

