You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.5 KiB
42 lines
1.5 KiB
package com.fr.plugin.xxxx.yyjm.fold; |
|
|
|
import com.fr.general.FArray; |
|
import com.fr.io.core.PageToSheetExcelExporterReport; |
|
import com.fr.report.report.Report; |
|
import com.fr.stable.StringUtils; |
|
|
|
import java.util.Map; |
|
|
|
/** |
|
* @Author fr.open |
|
* @Date 2021/11/16 |
|
* @Description |
|
**/ |
|
public class NameUtil { |
|
public static String getName(FArray names , String format, int currentPage){ |
|
String res = "Page"+currentPage; |
|
if(names == null || names.length() == 0){ |
|
return res; |
|
} |
|
if(StringUtils.isBlank(format)){ |
|
return names.elementAt(currentPage - 1).toString(); |
|
} |
|
res = format; |
|
res = res.replaceAll("TotalPageNumber",String.valueOf(names.length())); |
|
res = res.replaceAll("PageIndex",String.valueOf(currentPage - 1)); |
|
res = res.replaceAll("SheetName",names.elementAt(currentPage - 1).toString()); |
|
return res; |
|
} |
|
public static String getName(String defaultName, Report report, int i, Map map) { |
|
if(report instanceof PageToSheetExcelExporterReport){ |
|
}else{ |
|
return defaultName; |
|
} |
|
String sheetNames = (String) map.get("SHEET_NAME".toUpperCase()); |
|
String nameFormat = (String) map.get("NAME_FORMAT".toUpperCase()); |
|
if(StringUtils.isBlank(sheetNames) || StringUtils.isBlank(nameFormat)){ |
|
return defaultName; |
|
} |
|
return getName(new FArray(sheetNames.split(",")),nameFormat,Integer.valueOf(defaultName.replace("Page",""))); |
|
} |
|
}
|
|
|