我在excle单元格中有一个响应,如下所示
“ABX:喜SYSTEMTIME:120202020202”
我要替换
SYSTEMTIME:120202020202
有空的空间。我尝试使用 PdfPTable table = new PdfPTable(2);
table.setSpacingAfter(40.0f);
table.setTotalWidth(document.right()-document.left()-100);
try {
table.setWidths(new int[]{1, 2});
} catch (DocumentException e) {
e.printStackTrace();
}
PdfPCell cellOne = new PdfPCell(img);
Font f=new Font(Font.FontFamily.TIMES_ROMAN,20.0f,Font.BOLD, BaseColor.BLACK);
Font Para1_font=new Font(Font.FontFamily.TIMES_ROMAN,15.0f,Font.BOLD, BaseColor.BLACK);
Paragraph paragraph1_header = new Paragraph("QUOTE TO: 294087",f);
Paragraph paragraph = new Paragraph();
paragraph.add("AAAAAAAAAALLC * hhjkhhhhuhjbbnb" +
"jgjkll;, Sjklkjjjhh * AAHHGBJJ");
// Paragraph paragraph3 = new Paragraph();
// paragraph3.add("Page 1");
paragraph.setAlignment(Paragraph.ALIGN_LEFT);
PdfPCell cellTwo = new PdfPCell(paragraph);
// PdfPCell cellThree = new PdfPCell(paragraph3);
cellTwo.setPaddingLeft(10.0f);
cellOne.setPaddingBottom(20.0f);
cellTwo.setPaddingBottom(20.0f);
cellThree.setPaddingBottom(20.0f);
cellOne.setBorder(Rectangle.NO_BORDER);
cellTwo.setBorder(Rectangle.NO_BORDER);
cellThree.setBorder(Rectangle.NO_BORDER);
cellOne.setHorizontalAlignment(Element.ALIGN_LEFT);
cellTwo.setHorizontalAlignment(Element.ALIGN_LEFT);
cellThree.setHorizontalAlignment(Element.ALIGN_RIGHT);
table.addCell(cellOne);
table.addCell(cellTwo);
//table.addCell(cellThree);
try {
HeaderFooterPageEvent event = new HeaderFooterPageEvent(this, table);
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(path));
//writer.setBoxSize("art", new Rectangle(36, 54, 559, 788));
writer.setPageEvent(event);
document.open();
但未按预期工作。你能帮忙吗
答案 0 :(得分:0)
这就是你想要的吗
=LEFT(A1,FIND("systemTime",A1)-1)
编辑:根据评论
=SUBSTITUTE(A1,MID(A1,FIND("systemTime",A1)-1,FIND(",",MID(A1,FIND("systemTime",A1)-1,LEN(A1)-FIND("systemTime",A1)))),"")