Commit 7aaeb993 authored by Quxl's avatar Quxl

x

parent b87dbc95
......@@ -15,11 +15,12 @@ import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.ClientAnchor;
import org.apache.poi.ss.usermodel.CreationHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -607,14 +608,23 @@ public class ExportServiceImpl implements ExportService {
Cell cell = sheet.getRow(y-1).getCell(x-1);
if(cell != null) {
String tplValue = cell.getStringCellValue();
if(StringUtil.isNotBlank(tplValue) && tplValue.matches("(.+)?(_+)(.+)?")) {
cell.setCellValue(tplValue.replaceFirst("_+", value));
if(StringUtil.isNotBlank(tplValue)) {
if(tplValue.matches("_+")) {
cell.setCellValue(value);
} else if(tplValue.matches("(.+)?(_+)(.+)?")) {
cell.setCellValue(tplValue.replaceFirst("_+", value));
} else {
cell.setCellValue(value);
}
} else {
cell.setCellValue(value);
}
}
}
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
/**
* 处理剧照
*/
......@@ -627,8 +637,11 @@ public class ExportServiceImpl implements ExportService {
mvPhotoConn.setConnectTimeout(50 * 1000);
InputStream mvPhotoInstream = mvPhotoConn.getInputStream();
byte[] mvPhotoBytes = FileUtil.streamToBytes(mvPhotoInstream);
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)0, 3, (short)9, 3);
CreationHelper helper = sheet.getWorkbook().getCreationHelper();
ClientAnchor anchor = helper.createClientAnchor();
anchor.setRow1(3);
anchor.setCol1(0);
anchor.setAnchorType(3);
patriarch.createPicture(anchor, wb.addPicture(mvPhotoBytes, HSSFWorkbook.PICTURE_TYPE_JPEG));
} catch (FileNotFoundException e) {
e.printStackTrace();
......@@ -647,8 +660,11 @@ public class ExportServiceImpl implements ExportService {
directorPhotoConn.setConnectTimeout(50 * 1000);
InputStream directorPhotoInstream = directorPhotoConn.getInputStream();
byte[] directorPhotoBytes = FileUtil.streamToBytes(directorPhotoInstream);
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 0, 0, (short)2, 18, (short)3, 25);
CreationHelper helper = sheet.getWorkbook().getCreationHelper();
ClientAnchor anchor = helper.createClientAnchor();
anchor.setRow1(3);
anchor.setCol1(0);
anchor.setAnchorType(3);
patriarch.createPicture(anchor, wb.addPicture(directorPhotoBytes, HSSFWorkbook.PICTURE_TYPE_JPEG));
} catch (FileNotFoundException e) {
e.printStackTrace();
......@@ -670,7 +686,4 @@ public class ExportServiceImpl implements ExportService {
}
}
public static void main(String[] args) {
System.out.println("dsfa".matches("(.+)?(_+)(.+)?"));
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment