@@ -723,9 +723,11 @@ private JSONArray getParametersFromSingleWidgetBody(JSONObject body) {
723723
724724
725725 private void getActualValueFromDriverPlaceholder (JSONObject body , JSONArray parametersToReturn , JSONObject parameter ) throws JSONException {
726- if (parameter .getString ("value" ).contains ("$P{" )) {
727- String placeholderToReplace = parameter .getString ("value" ).replace ("$P{" , "" );
728- placeholderToReplace = placeholderToReplace .replace ("}" , "" );
726+ if (parameter .getString ("value" ).contains ("$P{" ) || parameter .getString ("value" ).contains ("${" )) {
727+ String placeholderToReplace = parameter .getString ("value" )
728+ .replace ("$P{" , "" )
729+ .replace ("${" , "" )
730+ .replace ("}" , "" );
729731 String actualValue = replaceParameterPlaceholderWithActualValue (placeholderToReplace , getDriversFromBody (body ));
730732 parameter .put ("value" , actualValue );
731733 }
@@ -1094,7 +1096,6 @@ public void fillTableSheetWithData(JSONObject dataStore, Workbook wb, Sheet shee
10941096
10951097 replaceWithThemeSettingsIfPresent (settings );
10961098
1097-
10981099 buildRowsAndCols (wb , sheet , offset , settings , rows , isGroup , startRow , rowspan , columnsOrdered , numberOfSummaryRows , summaryRowsLabels );
10991100 } catch (Exception e ) {
11001101 throw new SpagoBIRuntimeException (EXCEL_ERROR , e );
@@ -1178,6 +1179,8 @@ private void buildFirstPageHeaders(Workbook wb, Sheet sheet, String widgetName,
11781179 // renaming table columns names of the excel export
11791180 columnName = getInternationalizedHeader (columnName );
11801181
1182+ columnName = replaceWithCustomHeaderIfPresent (settings , columnName , column );
1183+
11811184 Cell cell = header .createCell (i );
11821185 cell .setCellValue (columnName );
11831186
@@ -1190,6 +1193,33 @@ private void buildFirstPageHeaders(Workbook wb, Sheet sheet, String widgetName,
11901193 }
11911194 }
11921195
1196+ private String replaceWithCustomHeaderIfPresent (JSONObject settings , String columnName , JSONObject column ) throws JSONException {
1197+ if (settings .has ("configuration" ) && settings .getJSONObject ("configuration" ).has ("headers" )) {
1198+ JSONObject customHeader = settings .getJSONObject ("configuration" ).getJSONObject ("headers" ).getJSONObject ("custom" );
1199+ if (customHeader .getBoolean ("enabled" )) {
1200+ JSONArray rules = customHeader .getJSONArray ("rules" );
1201+ for (int i = 0 ; i < rules .length (); i ++) {
1202+ JSONObject rule = rules .getJSONObject (i );
1203+ JSONArray target = rule .getJSONArray ("target" );
1204+ if (target .length () > 0 ) {
1205+ for (int j = 0 ; j < target .length (); j ++) {
1206+ if (target .getString (j ).equals (column .getString ("id" ))) {
1207+ if (rule .getString ("action" ).equals ("setLabel" )) {
1208+ columnName = rule .getString ("value" );
1209+ break ;
1210+ } else if (rule .getString ("action" ).equals ("hide" )) {
1211+ columnName = "" ;
1212+ break ;
1213+ }
1214+ }
1215+ }
1216+ }
1217+ }
1218+ }
1219+ }
1220+ return columnName ;
1221+ }
1222+
11931223 protected String getInternationalizedHeader (String columnName ) {
11941224 if (i18nMessages == null ) {
11951225 I18NMessagesDAO messageDao = DAOFactory .getI18NMessageDAO ();
0 commit comments