Aspose.Excel for Java 24.7 版本去验证
本帖最后由 lnastacies 于 2024-10-29 17:23 编辑第一次发帖,废话不多说上干货
1、设置Licence.xml 修改了
package com.aspose.cells;
import com.aspose.cells.a.a.i;
import com.aspose.cells.a.a.p;
import java.io.File;
import java.io.InputStream;
import java.io.Reader;
import java.net.URLDecoder;
import java.security.CodeSource;
import java.security.ProtectionDomain;
import java.util.Date;
import java.util.HashMap;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
public class License {
static String a;
public static boolean isLicenseSet() {
return true;
}
public static Date getSubscriptionExpireDate() {
return (axy.a == null) ? null : a(a);
}
public void setLicense(InputStream stream) {
Document document = null;
if (stream != null)
try {
DocumentBuilder documentBuilder = i.b();
document = documentBuilder.parse(stream);
} catch (Exception exception) {
throw new CellsException(9, "Error when parse license stream: " + exception.getMessage());
}
axy axy = new axy();
axy.a(document);
if (axy.b != null)
throw new CellsException(9, axy.b);
}
public void setLicense(String licenseFileName) {
File file = b(licenseFileName);
if (file == null)
throw new CellsException(9, "Cannot find license file: " + licenseFileName);
if (p.a())
p.a("Using license file: " + file.getAbsolutePath());
Document document = null;
try {
DocumentBuilder documentBuilder = i.b();
document = documentBuilder.parse(file);
} catch (CellsException cellsException) {
throw cellsException;
} catch (Exception exception) {
throw new CellsException(9, "Error when parse license file: " + exception.getMessage());
}
axy axy = new axy();
axy.a(document);
if (axy.b != null)
throw new CellsException(9, axy.b);
}
private File b(String paramString) {
File file = new File(paramString);
if (file.isFile())
return file;
if (p.a())
p.a("Cannot find license file " + file.getAbsolutePath());
try {
HashMap<Object, Object> hashMap1 = new HashMap<Object, Object>();
file = a(License.class, paramString, (HashMap)hashMap1);
if (file != null)
return file;
StackTraceElement[] arrayOfStackTraceElement = (new Exception()).getStackTrace();
HashMap<Object, Object> hashMap2 = new HashMap<Object, Object>();
hashMap2.put(License.class.getName(), Boolean.FALSE);
for (byte b = 2; b < arrayOfStackTraceElement.length; b++) {
String str = arrayOfStackTraceElement.getClassName();
if (!hashMap2.containsKey(str)) {
file = a(Class.forName(str), paramString, (HashMap)hashMap1);
if (file != null)
return file;
hashMap2.put(str, Boolean.FALSE);
}
}
} catch (Throwable throwable) {
if (p.a())
p.a(throwable.getClass().getName() + ":" + throwable.getMessage());
}
return null;
}
private File a(Class paramClass, String paramString, HashMap<String, Boolean> paramHashMap) throws Exception {
ProtectionDomain protectionDomain = paramClass.getProtectionDomain();
if (protectionDomain != null) {
CodeSource codeSource = protectionDomain.getCodeSource();
if (codeSource != null) {
File file = new File(URLDecoder.decode(codeSource.getLocation().getFile(), "UTF-8"));
if (file.getName().endsWith(".jar"))
file = file.getParentFile();
String str = file.getCanonicalPath();
if (paramHashMap.containsKey(str))
return null;
file = new File(file, paramString);
if (file.isFile())
return file;
paramHashMap.put(str, Boolean.FALSE);
if (p.a())
p.a("Cannot find license file " + file.getAbsolutePath());
}
}
return null;
}
public void setLicense(Reader reader) {
Document document = null;
if (reader != null)
try {
DocumentBuilder documentBuilder = i.b();
document = documentBuilder.parse(new InputSource(reader));
} catch (Exception exception) {
throw new CellsException(9, "Error when parse license reader: " + exception.getMessage());
}
axy axy = new axy();
axy.a(document);
if (axy.b != null)
throw new CellsException(9, axy.b);
}
static Date a(String paramString) {
return new Date(199, 12, 31);
}
}
2、秘钥验证代码修改
package com.aspose.cells;
import com.aspose.cells.a.a.d;
import com.aspose.cells.a.a.i;
import com.aspose.cells.a.l;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import javax.xml.parsers.DocumentBuilder;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
class axy {
static axy a = null;
String b = null;
private String c;
private final String d = d.a(new byte[] {
-75, 49, 117, 65, 81, -80, 27, 60, -56, 36,
42, -99, 96, 75, 24, -99, 21, -29, -57, -36,
108, 71, 15, -86, 76, 8, -110, -6, -125, 8,
69, 66, 12, 19, 54, 52, 54, -88, 99, -86,
18, -65, 30, -127, -12, 21, 9, -28, 43, -17,
5, 45, -12, 84, -109, 91, 52, 54, 33, 2,
-38, -35, 96, 42, -55, 101, 0, -124, 56, -45,
126, -89, 55, -102, 23, -21, 124, 78, -38, -10,
91, -108, 117, -56, 117, 23, 87, 12, 36, 63,
-98, -76, 51, 24, 28, 19, Byte.MAX_VALUE, 86, -32, 58,
48, -73, -19, 50, -116, 17, 101, -41, 108, 18,
-122, 25, -52, -70, 108, 26, 97, -103, -10, 99,
-24, 20, -127, 74, 19, 49, 20, 90, -101, 21,
-3, 10, 28, 21, 52, -30, -96, 51, 88, 28,
-101, 80, -5, 84, -92, 34, 20, 118, 46, -12,
37, 6, 113, -75, 99, -64, -108, 52, 13, -45,
21, 97, -26, 79, -123, -63, 34, 49, 20, 58,
92, -73, -30, 10, 16, 64, 74, 57, -74, 100,
-107, 102, 72, 69, 68, 118, -95, -15, 21, 33,
-65, -114, -111, -13, 41, -126, -108, -84, 72, 19,
76, -93, -60, 29, -43, 25, 20 });
private final String e = d.a(new byte[] {
-31, 27, -8, 76, -52, 61, -37, 23, -103, -107,
30, 4, -60, 19, -124, -55, 4, -9, -108, 31,
54, 45, -97, 78, -74, -105, -10, 20, 116, -112,
-40, 86, 13, -9, 21, 99, 57, -82, -48, 40,
-18, -55, 68, 28, 2, -127, -43, Byte.MAX_VALUE, 113, 27,
-77, 100, 16, 76, -120, -95, 8, 36, 101, 15,
-102, 20, -84, 14, -105, -7, 45, 54, -50, 20,
-120, -108, 81, 76, -94, 20, -95, -103, -57, -55,
-60, 30, -53, -107, -95, 101, 24, 126, 27, 109,
-76, 37, 88, 81, Byte.MAX_VALUE, -44, -87, -27, 84, 33,
83, 104, 125, -79, 20, 0, 45, -12, -2, 62,
-97, -107, Byte.MIN_VALUE, -110, -73, 108, 42, -1, -44, 78,
83, 104, 17, 8, -107, 32, 43, 86, -2, 25,
65, -44, 84, -92, -95, -70, -97, -56, -7, -83,
-16, 16, -82, -1, 89, -48, 101, -44, -3, -111,
-35, 88, -3, 20, 50, -112, -1, -107, -4, -50,
-28, 59, -52, -126, 108, 20, 47, 16, -62, -110,
-122, -79, -44, -20, -44, 9, -45, 20, -100, 118,
113, 3, -127, 82, -55, -88, 30, -60, -102, -76,
-42, -43, 26, 108, 85, -26, -116, 84, 63, -108,
-114, -28, 41, 25, -12, 57, 117, -88, -83, -45,
54, 92, 76, -41, 24, -54, 22, 117, -25, -2,
44, -60, -81, -15, -64, 41, -93, -122, -97, 52,
28, -61, -43, 20, 37, -112, -11, 22, 119, -78,
102, -122, 21, -49, -28, -66, 125, -79, 48, 21,
0, 75, 53, 4, 40, 21, -73, 52, 90, 12,
1, 54, -97, -37, -124, 27, 28, -28, 103, -115,
-9, 22, 19, 4, 69, -11, 40, -21, -108, -125,
88, 48, 13, -124, 31, -70, -98, -57, -82, 111,
120, 12, -104, 20, -83, 126, 41, 62, 94, 22,
88, 102, -42, 28, 16, -78, 20, 114, 65, 93,
-100, -99, 86, -32, -104, 36, 30, -9, -107, -24,
89, 88, 63, -124, 85, 72, 36, 32, 5, 125,
23, 108, 31, -84, -3, 105, -108, 4, 115, 40,
20, -53, 43, -83, 23, 98, 7, -70, 18, -3,
-74, -19, 72, 124, 2, -54, 110, -70, -67, -45,
7, 58, 49, 117, 116, 44, 117, Byte.MIN_VALUE, 47, -23,
-26, 28, 27, -96, 36, -44 });
private final String f = d.a(new byte[] {
118, 61, 38, -65, -32, -38, -10, 86, 32, 42,
-10, 23, -82, -3, 87, -89, 33, -25, 29, 116,
17, -100, 6, 45, -44, -51, 108, 15, -36, -114,
-12, 76, 99, 53, -12, 67, -103, 102, 84, -71,
-11, -58, 111, 84, -104, 58, -107, -82, -119, -57,
23, -63, 90, 113, -54, 61, 83, -25, 110, 36,
38, 82, 92, -103, 46, 46, 63, -34, -8, -15,
-110, 71, 26, -11, -111, -122, -16, 20, -90, -16,
-73, 103, -107, 124, 85, Byte.MAX_VALUE, 33, 59, -92, -76,
3, 45, -11, -59, 100, 50, 92, 89, -4, 61,
63, 72, 24, -126, 21, 15, -31, 51, 21, 117,
35, -23, -108, 67, 123, -21, 120, -24, 23, -60,
106, 19, 20, 48, 30, 44, 121, -20, 6, 60,
15, -36, -56, -28, 41, -116, 35, 102, 47, 116,
16, -63, -74, 109, -23, 20, 90, 20, 61, -66,
-7, -41, 48, 84, 38, -59, -106, 45, -69, 117,
-11, -20, -11, -109, 19, 44, 31, 118, 21, -96,
69, -88, 126, 20, -81, -9, 61, -47, -95, -9,
-82, 113, -49, -88, 52, 20, 69, 37, 73, -85,
84, 95, 69, -44 });
private final String g = d.a(new byte[] {
14, 36, -112, 35, -109, -82, 116, 14, -50, 95,
-19, -59, -59, -14, 1, -6, -43, 108, -67, 9,
-108, 25, -38, 17, 88, 62, -69, 60, 23, 100,
-59, -76, 21, 47, 99, -108, 78, -117, 32, -104,
20, -82, 10, 100, 63, 57, 80, -65, 73, 86,
71, 108, -77, 21, -30, 44, -12, -75, -2, 47,
-32, -90, 45, -108, -12, 53, -81, 13, -37, 23,
37, -89, -16, 87, 68, -23, 112, -77, 20, 57,
7, 74, 16, 19, -76, -27, -112, 44, 60, -108,
109, 124, -118, -108, 78, -78, -79, 100, -44, -119,
40, -76, 57, 91, 88, 23, -53, -104, 57, 119,
-77, -32, 38, 20, -54, 36, 54, 44, 65, 95,
-12, 15, -110, 22, 39, 14, -97, -37, 22, 116,
4, 60, -55, 100, 6, -11, 0, -101, 8, -109,
125, -122, 92, 20, -38, -20, 8, 75, 109, -35,
50, -77, -33, 60, 6, 58, 56, 25, 18, 35,
92, -96, 20, -66, -56, 84, 41, -9, 50, 51,
95, -48, -18, 97, -92, 31, -103, 107, -81, 18,
-61, -108, 72, 26, -76, -28, -52, 112, 63, -109,
17, -77, 72, 125, -44, 66, 83, 108, 5, -80,
-37, 67, -9, 92, 28, 118, 65, 21, 33, -12,
94, 115, -101, 14, -51, 44, 28, 28, -15, -108,
42, 64, 30, -101, -62, 21, -55, 36, 10, -32,
65, 22, 80, -101, 11, -12, 65, 108, -119, -28,
59, 33, 35, -127, 77, 2, 21, -90, 33, -10,
20, 120, 23, -93, -75, 98, 3, 66, -59, 104,
-63, -99, -1, -44, -124, -42, 64, -97, 1, 6,
-3, -111, 105, -10, -96, -7, -82, -108, 95, 32,
-66, 28, 17, 103, -44, 17, -46, -6, 63, 107,
-4, 30, -34, 85, -68, -86, 33, 46, 21, 80,
-123, -69, 21, -61, 112, 15, -93, -28, 14, 54,
-123, -16, 100, -76, 93, -127, 112, -123, -37, 22,
56, 100, 33, 7, -125, 41, -79, 28, 28, -82,
-10, 100, 7, -125, -41, -118, 98, -50, -30, 95,
78, 20, 68, -91, -85, 21, -10, 63, -120, 3,
39, 96, 53, -35, 71, -117, -55, -55, -7, -108,
20, -45, -78, 87, -77, 103, -108, -36, -55, -92,
37, -40, -69, -85, 16, 96, 20, 20 });
private final String h = d.a(new byte[] { -127, 6, -105, 22, 20, 28, 20 });
static int a(String paramString) {
if (bso.a)
return 0;
Date date = a.a();
return (date != null && date.before(new Date())) ? 0 : 1;
}
static void a(bav parambav) {
_k.a = -1;
}
void a(Document paramDocument) {
if (paramDocument != null) {
cyz.a(paramDocument);
paramDocument.getDocumentElement().normalize();
Element element = paramDocument.getDocumentElement();
Node node1 = element.getElementsByTagName(d.a(new byte[] { 7, 88, 94, 50, 23, -84, 46, 20 })).item(0);
Node node2 = element.getElementsByTagName(d.a(new byte[] {
88, 29, -100, 45, 89, 91, 21, 113, 15, 46,
12, -117, 92, 20 })).item(0);
if (node1 != null && node2 != null) {
NodeList nodeList = node1.getChildNodes();
Node node = cyz.a(nodeList, d.a(new byte[] {
-48, 70, 78, 81, 87, 22, 51, -64, -127, 45,
55, 20 }));
boolean bool1 = false;
boolean bool2 = false;
String[] arrayOfString = null;
if (node != null) {
NodeList nodeList1 = node.getChildNodes();
arrayOfString = new String;
for (int i = nodeList1.getLength() - 1; i > -1; i--) {
Node node3 = nodeList1.item(i).getLastChild();
String str = (node3 == null) ? "" : node3.getNodeValue();
if (str.equals(d.a(new byte[] {
-73, -59, -127, 102, -8, -44, 95, 86, -66, 10,
17, -127, -33, 113, 36, -87, -104, 86, 122, -44,
-116, -126, 13, -57, 22, -48, -43, -107, -107, -72,
103, -52, 13, 22, 54, 116, -44, -116, -94, 12,
24, 86, -28, 20 })) || str.equals(d.a(new byte[] {
103, 87, 12, -111, -96, -120, -66, 10, 17, -127,
-33, 113, 36, -87, -104, 86, 122, -44, -116, -126,
13, -57, 22, -42, -44, 47, 38, 7, -106, 116,
-44, -68, 98, 12, 1, 20, 20 }))) {
bool2 = true;
arrayOfString = l.c;
} else {
bool1 = true;
arrayOfString = b(str);
}
}
} else {
a = null;
abz.a();
return;
}
if (a(cyz.a(node1), node2.getLastChild().getNodeValue(), bool1, bool2)) {
String str1 = null;
String str2 = null;
String str3 = null;
try {
for (int i = nodeList.getLength() - 1; i > -1; i--) {
Node node3 = nodeList.item(i);
String str = node3.getNodeName();
if (str.equals(d.a(new byte[] {
-83, -56, -5, -79, -104, 107, 118, 60, -84, 27,
-35, 104, -127, 70, 108, -8, -95, 2, 20, 20 }))) {
Node node4 = node3.getLastChild();
if (node4 == null) {
this.b = d.a(new byte[] {
-28, 72, 37, -60, -4, 7, -58, 100, 49, -95,
-100, -12, 120, 56, 19, -90, 85, 21, 116, 65,
-68, 56, 16, -90, -37, -74, -44, 2, -12, 20 });
return;
}
String str4 = node4.getNodeValue();
if (!str4.equals(d.a(new byte[] {
74, -107, -51, 68, -44, -99, -31, -127, -102, 34,
75, 109, 3, 20 })) && !str4.equals(d.a(new byte[] {
61, -11, 48, 92, -124, 42, 116, -97, 118, -68,
-84, 0, -53, 17, -95, -49, 49, -60, 20 }))) {
this.b = d.a(new byte[] {
70, 40, -32, -120, 29, 121, 118, 44, 15, 31,
21, -8, -124, 84, 76, 1, 126, 31, 21, 56,
-89, -4, -92, 17, -84, 20 });
return;
}
} else if (str.equals(d.a(new byte[] {
38, -36, 41, -119, -104, -99, Byte.MIN_VALUE, -8, 65, -16,
121, 35, -108, -119, -31, 3, -124, 20 }))) {
Node node4 = node3.getLastChild();
str1 = (node4 == null) ? "" : node4.getNodeValue();
} else if (str.equals(d.a(new byte[] {
5, 88, -68, -83, -52, 47, 103, -62, -35, 73,
-26, 65, 92, 13, -61, 49, -82, 20 }))) {
Node node4 = node3.getLastChild();
if (node4 != null)
str2 = node4.getNodeValue();
} else if (str.equals(d.a(new byte[] {
-72, 1, -111, 126, -30, 47, -23, 19, 121, 3,
10, 83, -76, -78, -4, 20, -38, -83, 57, -60,
20 }))) {
Node node4 = node3.getLastChild();
if (node4 != null)
this.c = node4.getNodeValue();
} else if (str.equals(d.a(new byte[] {
22, -93, 83, 94, 32, -88, 82, -74, 2, -79,
-11, 109, -108, 14, -84, -115, 52, 126, 36, 20 }))) {
Node node4 = node3.getLastChild();
str3 = (node4 == null) ? "" : node4.getNodeValue();
}
}
} catch (CellsException cellsException) {
this.b = cellsException.getMessage();
return;
} catch (Exception exception) {
this.b = d.a(new byte[] {
-23, -101, -74, 83, 108, 74, -102, -67, 22, -123,
31, 21, -8, 102, 88, 21, 58, 22, 31, 20,
-71, 60, 68, 76, 27, 117, -124, -50, -107, 124,
12, 20 });
return;
}
if (str2 == null) {
this.b = d.a(new byte[] {
119, 78, 83, 92, -82, -126, 99, -26, 46, -80,
30, 80, 56, 19, -91, -35, 36, 16, -84, 28,
56, 22, -96, -75, 85, 116, 41, -110, 87, 126,
17, -76, 116 });
return;
}
if (k(str1)) {
a(arrayOfString);
char[] arrayOfChar = l.d.toCharArray();
arrayOfChar = arrayOfChar;
arrayOfChar = arrayOfChar;
arrayOfChar = arrayOfChar;
arrayOfChar = arrayOfChar;
for (byte b = 0; b < 8 && arrayOfChar >= str2.charAt(b); b++) {
if (arrayOfChar > str2.charAt(b)) {
this.b = (new StringBuffer(128)).append(d.a(new byte[] {
-35, -21, 59, 17, 108, -2, -124, 61, 4, -92,
38, -47, 82, 116, -100, 116, 99, 92, -7, 116,
76, 5, 119, -104, -92, 50, 85, 4, 86, -44,
63, 94, 30, 2, 22, 78, 8, 21, -92, -92,
10, -45, 48, -44, 6, -12, 52, -92, 14, -41,
21, Byte.MAX_VALUE, 97, -80, 2, 22, 77, 69, -60, 20,
-92, 54, -41, 69, -14, -100, 18, 93, 17, -108,
-94, -115, -111, 76, 18, 2, 20, 20 })).append(str2, 0, 4).append('-').append(str2, 4, 6).append('-').append(str2, 6, 8).append(d.a(new byte[] {
-109, -83, 91, 118, 116, 100, 19, 118, -107, 45,
17, -108, -126, -109, 20, 120, 56, 19, -90, -59,
23, 72, 81, 48, 56, 22, -89, 38, 21, 116,
9, -126, 108, -44, 2, 23, -52, -14, -87, -107,
-124, 54, 2, 21, -52, Byte.MAX_VALUE, 22, 85, 116, 81,
-110, -99, 2, 84, 92, -105, 31, 20, -71, -43,
21, 116, 20 })).append(l.d).append(d.a(new byte[] {
-118, -73, 18, -43, -120, 18, 17, -92, -33, 52,
48, 84, -92, 2, -33, 32, 29, 16, -106, -44,
47, 56, -27, -108, 56, 24, -91, 69, -116, 54,
12, 9, -58, 47, 76, 2, 21, 79, -44, -42,
-44, 47, 57, 19, 20, 56, 21, -92, -111, -107,
2, 77, 121, 16, 92, -68, 44, 56, 19, -90,
-59, 23, 72, 81, 48, 56, 22, -89, 38, 21,
116, 9, -126, 108, -44, 2, 23, -52, -14, -87,
-107, -124, 54, 2, -12, 20 })).toString();
return;
}
}
if (this.c != null) {
Calendar calendar = Calendar.getInstance();
byte[] arrayOfByte = new byte;
int i = calendar.get(1);
arrayOfByte = (byte)(i / 1000 + 48);
arrayOfByte = (byte)(i % 1000 / 100 + 48);
arrayOfByte = (byte)(i % 100 / 10 + 48);
arrayOfByte = (byte)(i % 10 + 48);
i = calendar.get(2);
if (i < 9) {
arrayOfByte = 48;
arrayOfByte = (byte)(i + 49);
} else {
arrayOfByte = (byte)(++i / 10 + 48);
arrayOfByte = (byte)(i % 10 + 48);
}
i = calendar.get(5);
if (i < 10) {
arrayOfByte = 48;
arrayOfByte = (byte)(i + 48);
} else {
arrayOfByte = (byte)(i / 10 + 48);
arrayOfByte = (byte)(i % 10 + 48);
}
for (byte b1 = 0; b1 < 8 && arrayOfByte >= this.c.charAt(b1); b1++) {
if (arrayOfByte > this.c.charAt(b1)) {
this.b = d.a(new byte[] {
-96, -56, 5, -86, -88, 9, 70, 17, 54, 2,
23, -52, -16, -116, 22, 72, 16, 2, 21, -52,
119, -106, 85, 116, 41, -122, 25, 12, 67, 16,
21, 122, 20 });
return;
}
}
}
License.a = str2;
a = this;
bse.a();
return;
}
}
}
}
License.a = null;
a = null;
abz.a();
}
Date a() {
return License.a(this.c);
}
private static String b(String paramString) {
return l.a.equals(d.a(new byte[] {
-82, 2, -49, 80, -55, 113, Byte.MIN_VALUE, -96, 40, 28,
-67, -77, 20, 20 })) ? g(paramString) : (l.a.equals(d.a(new byte[] {
-94, -23, -23, 62, 82, 27, 85, -44, -94, 40,
122, -74, 36, 20 })) ? c(paramString) : (l.a.equals(d.a(new byte[] {
-38, -114, -109, -67, -127, 94, -44, 74, -47, -35,
114, -109, -14, -68, 20 })) ? d(paramString) : (l.a.equals(d.a(new byte[] { 75, -55, -73, -68, 116, 37, 20, 20 })) ? e(paramString) : (l.a.equals(d.a(new byte[] {
-99, -37, -85, -92, 101, -66, 12, 0, -36, -41,
-5, 20 })) ? f(paramString) : (l.a.equals(d.a(new byte[] {
-15, -59, -94, 80, 18, 96, -18, 34, -127, -108,
-87, 39, 35, 85, 25, -39, 57, 1, 70, 20 })) ? h(paramString) : (l.a.equals(d.a(new byte[] { 67, 50, -67, -12, 38, -90, 61, 84, 20 })) ? i(paramString) : (l.a.equals(d.a(new byte[] {
-118, 67, 7, 80, -41, -82, -88, 120, 22, -93,
-5, 20 })) ? j(paramString) : g(paramString))))))));
}
private static String c(String paramString) {
if (paramString.equals(d.a(new byte[] {
102, -61, -126, -120, 89, 100, -64, 8, 24, -69,
-81, 61, 18, -55, -108, -70, -9, -94, 52, 26,
2, 21, -51, -124, -120, 7, 18, 16, 50, -90,
94, 23, -126, 68, 17, -108, 98, 14, -68, 20,
-116, 36, 62, 9, -110, 17, 84, 20 })) || paramString.equals(d.a(new byte[] {
47, -6, 108, -54, 72, 53, -106, 126, 26, 18,
67, -55, Byte.MIN_VALUE, -106, 122, -44, -116, -126, 13, -57,
22, -42, -44, 47, 38, 7, -106, 116, -44, -112,
-62, 93, 84, 102, -34, 20, -92, 26, -41, 65,
20, 7, 18, 17, 87, -92, -44, -68, 20 })) || paramString.equals(d.a(new byte[] {
-76, 6, 94, -5, 24, -23, 36, -121, 68, 100,
38, -86, -8, -80, 15, 98, 22, -81, -102, -52,
-108, 44, 76, 19, 114, 86, 100, 88, 12, 4,
-114, -35, 60, 26, 77, 84, 20 })) || paramString.equals(d.a(new byte[] {
-10, -76, -101, -124, -91, -98, -67, 36, -64, 8,
24, -69, -81, 61, 16, -55, -107, 37, 56, 39,
-78, 17, -111, -108, 98, 112, 51, 16, -43, -107,
29, -72, -122, -108, -15, Byte.MIN_VALUE, 20 })) || paramString.equals(d.a(new byte[] {
70, 120, -64, 8, 24, -69, -81, 61, 16, -55,
-107, 37, 56, 39, -78, 17, -99, -105, 23, 23,
76, -13, -92, 38, 16, 80, -43, -107, 37, 120,
36, 12, -111, -12, 20 })) || paramString.equals(d.a(new byte[] {
69, -59, -68, 44, 13, 75, 98, 70, 25, -81,
21, 73, -45, 120, 84, 8, 88, 12, 12, 14,
-45, 41, -107, -124, 54, 50, 24, 29, -97, 117,
-108, -48, 59, 20 })))
return l.c;
throw new CellsException(9, d.a(new byte[] {
83, 104, 73, -73, -66, 84, -80, 86, -44, 111,
8, -121, 20, 95, -108, -106, -44, 63, 94, 0,
2, 21, -49, -124, 2, 31, 21, 120, 33, 84,
-96, 24, 56, 23, -89, 53, 44, 2, 22, 78,
8, 21, -92, -92, 10, -45, 33, -8, 24, -107,
4, -93, 20 }));
}
private static String d(String paramString) {
if (paramString.equals(d.a(new byte[] {
5, -91, -68, 44, 13, 75, 98, 70, 25, -81,
21, 73, -45, 120, 84, 8, 56, 23, -89, 53,
44, 50, 24, 30, -121, 71, -38, -104, -12, 4,
105, 115, 117, 31, 20, -8, 33, 68, 21, 36,
116, 64, 47, 24, 30, -108, 20 })) || paramString.equals(d.a(new byte[] {
-115, 98, -51, -68, 44, 13, 75, 98, 70, 29,
-81, 22, 118, 76, 115, 88, 31, 31, 20, -8,
-36, 90, 29, -105, 22, -80, -64, -25, -73, 44,
16, 11, 77, -52, 86, -44, 47, 25, 64, 20,
88, 12, 1, 26, -41, 22, -76, 20 })) || paramString.equals(d.a(new byte[] {
83, 30, -101, 18, -76, -12, 113, 105, -51, 92,
34, -8, 17, 99, 9, -91, 20, 100, -92, 26,
-40, -112, -12, -116, 36, 58, 9, -123, -92, 5,
35, 116, 108, 15, -116, 76, 19, 117, -66, -108,
29, -105, 22, -75, -52, 116, 64, 20 })) || paramString.equals(d.a(new byte[] {
-101, 111, 18, -19, -78, -76, -12, 113, 105, -51,
92, 50, -8, 29, -99, 117, -119, 36, 56, 56,
23, -89, 53, 44, 50, 24, 31, -109, 112, 120,
16, 89, -52, 10, 18, -14, 2, 21, -52, 126,
-76, 22, 116, -44, -68, 98, 12, 1, 20, 20 })) || paramString.equals(d.a(new byte[] {
44, -5, 33, -43, -97, 43, -105, 68, 100, 38,
-86, -8, -80, 7, 98, 16, -48, -92, -38, -116,
2, 50, 24, 24, 25, 119, -118, -44, -36, 5,
7, 18, 16, -47, -92, -44, 118, 3, -108, 20 })) || paramString.equals(d.a(new byte[] {
-56, -115, 33, 19, 23, 63, -6, -34, 85, -93,
116, 63, -84, -7, -100, 23, -99, -105, 23, 23,
76, -13, -92, 38, 16, 80, -43, -107, 37, 120,
36, 12, -111, -12, 20 })))
return l.c;
throw new CellsException(9, d.a(new byte[] {
109, -43, 52, -33, -31, -32, 44, -2, -124, 61,
4, -92, 10, -45, 48, -44, 6, -12, 52, -92,
30, -58, -111, 17, -108, 98, -16, 17, -106, -44,
79, 25, 68, 57, 23, 31, 20, -8, -36, 90,
17, -108, -126, -109, 20, 120, 56, 19, -91, -39,
111, 23, 52, 80, 57, -44 }));
}
private static String e(String paramString) {
if (paramString.equals(d.a(new byte[] {
89, 123, -91, 22, 14, -105, -107, -127, -29, 113,
52, -49, -92, 1, -56, 98, -48, 21, -42, -44,
47, 38, 7, -111, 116, -44, -42, -104, 20, 9,
-110, -66, 20, 50, 24, 30, -109, 117, -107, 68,
20 })) || paramString.equals(d.a(new byte[] {
88, -39, 107, 80, 33, 19, 23, 63, -6, -34,
85, 35, 116, 88, 95, 24, -3, -107, 117, 116,
9, -115, 29, -42, -92, 116, 117, 82, 20, 26,
-41, 65, 20, 7, 18, 17, 87, -92, -44, -68,
20 })) || paramString.equals(d.a(new byte[] {
-93, 70, -63, 86, 122, 18, -76, -12, 113, 105,
-51, 92, 50, -8, 29, -99, 117, -119, 36, 56,
88, 12, 12, 14, -45, 41, -107, -124, 54, 50,
24, 29, -97, 117, -108, -48, 59, 20 })) || paramString.equals(d.a(new byte[] {
-125, -78, -76, -12, 113, 105, -51, 92, 34, -8,
17, 99, 9, -91, 20, 101, 36, 116, 116, Byte.MAX_VALUE,
8, -30, 18, 84, -100, -116, 36, 50, 57, -110,
23, 4, -88, 20 })))
return l.c;
throw new CellsException(9, d.a(new byte[] {
91, -122, -115, -39, 119, -66, 84, -80, 86, -44,
111, 8, -121, 20, 95, -108, -106, -44, 63, 94,
0, 2, 21, -49, -124, 2, 31, 21, 120, 33,
84, -96, 24, 56, 23, -89, 53, 44, 2, 22,
78, 8, 21, -92, -92, 10, -45, 33, -8, 24,
-107, 4, -93, 20 }));
}
private static String f(String paramString) {
if (paramString.equals(d.a(new byte[] {
33, -55, -5, 126, -6, -114, -105, -107, -127, -29,
113, 52, -49, -92, 1, -56, 98, -48, 21, -42,
-44, 47, 38, 7, -106, 116, -44, -44, -94, -98,
56, 21, -40, 2, 21, -52, 126, -76, 22, 116,
-44, -68, 98, 12, 1, 20, 20 })) || paramString.equals(d.a(new byte[] {
93, -49, -75, -80, 101, -68, 44, 13, 75, 98,
70, 29, -81, 22, 118, 76, 115, 88, 31, 31,
20, -8, -36, 90, 29, -105, 23, 22, -50, 60,
-92, 19, 36, 76, 19, 117, -66, -108, 29, -105,
22, -75, -52, 116, 64, 20 })) || paramString.equals(d.a(new byte[] {
-29, -3, -111, -115, 89, 18, -76, -12, 113, 105,
-51, 92, 50, -8, 29, -99, 117, -119, 36, 56,
88, 12, 12, 14, -45, 41, -107, -124, 54, 50,
24, 29, -97, 117, -108, -48, 59, 20 })) || paramString.equals(d.a(new byte[] {
-55, 39, -114, -105, -107, -127, -29, 113, 52, -49,
-92, 1, -56, 98, -48, 21, -48, -43, -107, -107,
-72, 103, -52, 13, 22, 54, 116, -44, -116, -94,
12, 24, 86, -28, 20 })))
return l.c;
throw new CellsException(9, d.a(new byte[] {
-34, 47, -55, 118, -20, 97, 92, 0, -100, 76,
27, 119, -122, 116, 29, 100, 4, 76, 17, 125,
86, -106, -44, 47, 102, 22, -43, 116, 57, -110,
-68, 2, -107, -111, -108, 98, 112, 51, 22, -44,
95, 87, -108, 34, 2, 23, -52, -14, -87, -107,
-124, 54, 2, -12, 20 }));
}
private static String g(String paramString) {
return paramString.equals(d.a(new byte[] {
26, -58, 119, -33, -39, 85, -44, -34, -17, -90,
-124, 89, -60, 58, 95, 9, 68, 29, 53, 116,
9, -115, 29, -43, 36, 116, 64, 47, 24, 30,
-108, 20 })) ? d.a(new byte[] {
103, 40, -7, 4, 91, -58, 126, 26, 18, 67,
-55, Byte.MIN_VALUE, -105, 122, -44, 67, 101, -49, 4, 19,
31, 20, -8, -36, 90, 29, -105, 22, -75, -52,
116, 64, 20 }) : (paramString.equals(d.a(new byte[] {
40, 75, -114, 99, 109, -66, 33, 19, 23, 63,
-6, -34, 85, -93, 116, 63, -84, -7, -100, 23,
-111, -108, 98, 112, 51, 16, -43, -107, 29, -72,
-122, -108, -15, Byte.MIN_VALUE, 20 })) ? d.a(new byte[] {
84, 28, 27, 55, 68, 100, 38, -86, -8, -80,
15, 98, 22, -81, -102, -52, -108, 44, 76, 19,
114, 86, 100, 88, 12, 4, -114, -35, 60, 26,
77, 84, 2, 21, -52, 126, -76, 22, 116, -44,
-68, 98, 12, 1, 20, 20 }) : ((paramString.equals(d.a(new byte[] {
-6, -30, -93, 59, 5, 13, 6, 16, 89, 85,
-44, -34, -17, -90, -124, 89, -52, 7, 6, -41,
46, 116, 76, 20 })) || paramString.equals(d.a(new byte[] {
-30, 35, -106, 108, 45, 25, 85, -44, -34, -17,
-90, -124, 89, -52, 7, 6, -41, 46, 116, 76,
76, 19, 114, 86, 100, 88, 12, 1, 26, -41,
22, -76, 20 })) || paramString.equals(d.a(new byte[] {
10, -75, 25, 85, -44, -34, -17, -90, -124, 89,
-52, 7, 6, -41, 46, 116, 76, -116, 36, 36,
33, -102, 111, 23, 52, 80, 88, 12, 7, 2,
-41, 21, -100, 74, 20 })) || paramString.equals(d.a(new byte[] {
82, 34, -101, 25, 85, -44, -34, -17, -90, -124,
121, -52, 30, -6, 47, 118, 20, -10, 116, -44,
-44, -62, 45, -8, 24, -107, 5, 36, 116, 88,
79, 24, 18, 53, 108, 20 }))) ? l.c : paramString));
}
private static String h(String paramString) {
return (paramString.equals(d.a(new byte[] {
-99, 66, 83, 9, -107, -68, 44, 13, 75, 98,
70, 29, -81, 22, 118, 76, 115, 88, 31, 20 })) || paramString.equals(d.a(new byte[] {
-119, -63, 14, -105, -107, -127, -29, 113, 52, -113,
-92, 50, 49, -110, 96, -44, -92, -92, 26, -40,
-112, -12, -116, 36, 62, 9, -110, 17, 84, 20 })) || paramString.equals(d.a(new byte[] {
-88, 54, 36, -101, -63, -13, 33, 19, 23, 63,
-6, -34, 85, 35, 116, 88, 95, 24, -3, -107,
118, 116, -44, -44, -62, 45, -8, 24, -107, 5,
36, 116, 88, 79, 24, 18, 53, 108, 20 })) || paramString.equals(d.a(new byte[] {
-26, 55, 111, 41, -116, -88, -64, 8, 24, -69,
-81, 61, 18, -55, -108, -70, -9, -94, 52, 26,
50, 24, 24, 25, 119, -118, -44, -36, 5, 7,
18, 16, -47, -92, -44, 118, 3, -108, 20 })) || paramString.equals(d.a(new byte[] {
-35, -92, -64, -103, -51, -68, 44, 13, 75, 98,
70, 29, -81, 22, 118, 76, 115, 88, 31, 31,
20, -8, -36, 90, 29, -105, 22, -78, 64, -89,
-11, 109, 44, 20, 89, -13, 116, -98, 4, 20 })) || paramString.equals(d.a(new byte[] {
80, 114, -120, 33, 19, 23, 63, -6, -34, 85,
-93, 116, 63, -84, -7, -100, 23, -111, -108, 98,
112, 51, 16, -43, -107, 71, 62, 77, -28, -88,
-120, 20, 50, -25, -92, 81, 28, 20 }))) ? l.c : paramString;
}
private static String i(String paramString) {
if (paramString.equals(d.a(new byte[] {
11, 64, 18, -76, -12, 113, 105, -51, 92, 50,
-8, 29, -99, 117, -119, 36, 56, 20 })) || paramString.equals(d.a(new byte[] {
118, 107, 13, -39, -95, 4, 23, 4, -64, 8,
24, -69, -81, 61, 16, -55, -107, 37, 56, 39,
-78, 17, -111, -108, 98, 112, 51, 16, -43, -107,
68, -8, 36, 62, 20, 20 })) || paramString.equals(d.a(new byte[] {
11, -65, -46, -76, -12, 113, 105, -51, 92, 50,
-8, 29, 95, 112, -124, 68, 17, -11, 116, 9,
-115, 29, -43, 36, 116, 64, 47, 24, 30, -108,
20 })) || paramString.equals(d.a(new byte[] {
-110, -112, 68, -39, 85, -44, -34, -17, -90, -124,
89, -52, 7, 6, -41, 46, 116, 76, -116, 36,
36, 33, -102, 111, 23, 52, 80, 88, 12, 7,
2, -41, 21, -100, 74, 20 })) || paramString.equals(d.a(new byte[] {
10, -108, -39, 85, -44, -34, -17, -90, -124, 89,
-52, 6, -126, -35, 52, -76, 31, -48, -43, -107,
-107, -72, 103, -52, 13, 22, 54, 116, -44, -116,
-94, 12, 24, 86, -28, 20 })))
return l.c;
throw new CellsException(9, d.a(new byte[] {
-107, 92, -56, -92, -2, -124, 61, 4, -92, 10,
-45, 48, -44, 6, -12, 52, -92, 30, -58, -111,
17, -108, 98, -16, 17, -106, -44, 79, 25, 68,
57, 23, 31, 20, -8, -36, 90, 17, -108, -126,
-109, 20, 120, 56, 19, -91, -39, 111, 23, 52,
80, 57, -44 }));
}
private static String j(String paramString) {
if (paramString.equals(d.a(new byte[] {
-9, 24, 100, 74, 53, 24, -16, -110, -114, 50,
9, -63, -9, 116, 1, -85, 108, -113, -76, 89,
34, 13, -71, 96, -43, 32, 45, -75, 116, 9,
-115, 29, -43, 36, 116, 64, 47, 24, 30, -108,
20 })) || paramString.equals(d.a(new byte[] {
-112, -66, 20, 89, 7, 26, -2, -27, -92, 30,
-53, -88, 89, -60, 62, -113, 24, -14, 40, 5,
80, -120, -60, -92, 26, -40, -112, -12, -116, 36,
62, 9, -110, 17, 84, 20 })) || paramString.equals(d.a(new byte[] {
-53, 13, 125, -74, 117, -55, 74, 34, 21, 79,
-29, -99, -82, 17, 71, 113, Byte.MIN_VALUE, -116, -107, -70,
54, -122, 2, 21, -51, -124, -120, 7, 18, 17,
87, -92, -44, -68, 20 })) || paramString.equals(d.a(new byte[] {
11, 82, -99, -74, 117, -55, 74, 34, 21, 79,
-29, -123, -81, 21, 105, -81, 9, -87, 68, 36,
-92, 26, -40, -112, -12, -116, 36, 62, 9, -110,
17, 84, 20 })) || paramString.equals(d.a(new byte[] {
73, -118, -78, -99, -109, 97, 108, -52, 17, 123,
-54, 50, -8, 29, 69, 117, -124, 114, -106, 96,
-99, 22, -44, 47, 38, 7, -106, 116, -44, -68,
98, 12, 1, 20, 20 })) || paramString.equals(d.a(new byte[] {
45, -26, 2, 79, -39, 49, -106, 124, -116, 99,
67, -103, -108, 66, -23, -10, 122, -44, Byte.MIN_VALUE, -94,
12, -108, -100, -102, 2, 21, -51, -124, -120, 7,
18, 17, 87, -92, -44, -68, 20 })) || paramString.equals(d.a(new byte[] {
-36, 126, 41, -111, -16, -59, 36, -6, -69, 15,
20, -71, -17, -46, -55, -108, -22, -14, -92, -57,
20, -43, 36, 17, -108, 98, 112, 51, 16, -43,
-107, 68, -8, 36, 62, 20, 20 })) || paramString.equals(d.a(new byte[] {
113, 12, -64, -59, 123, -66, -57, -78, -99, -109,
97, 108, -52, 17, 123, -54, 50, -8, 30, 31,
113, -100, 29, 21, -75, 116, 9, -115, 29, -43,
36, 116, 64, 47, 24, 30, -108, 20 })) || paramString.equals(d.a(new byte[] {
106, 88, 107, -60, -50, -51, 71, 80, -41, -82,
-88, 120, 22, -93, -5, 7, 98, 16, -48, -92,
-38, -116, 2, 2, 21, -51, -124, -120, 7, 18,
17, 87, -92, -44, -68, 20 })))
return l.c;
throw new CellsException(9, d.a(new byte[] {
-11, 121, -36, 11, -61, 83, -93, 100, -2, -124,
61, 4, -92, 10, -45, 48, -44, 6, -12, 52,
-92, 30, -58, -111, 17, -108, 98, -16, 17, -106,
-44, 79, 25, 68, 57, 23, 31, 20, -8, -36,
90, 17, -108, -126, -109, 20, 120, 56, 19, -91,
-39, 111, 23, 52, 80, 57, -44 }));
}
private boolean a(String paramString1, String paramString2, boolean paramBoolean1, boolean paramBoolean2) {
return true;
}
private boolean k(String paramString) {
return true;
}
private ArrayList b() {
try {
InputStream inputStream = License.class.getResourceAsStream(d.a(new byte[] {
-72, 87, 107, 80, 95, -60, -95, 109, 31, 108,
20 }) + License.class.getPackage().getName().replace('.', '/') + d.a(new byte[] {
82, 85, 82, 22, -54, -113, 8, -27, 85, -122,
108, 17, 21, 35, -44, -123, 120, -69, 73, 100,
1, -81, 21, -6, -31, -56, 98, 77, 58, 22,
15, -92, 0, -17, 41, 105, 111, -91, 72, -44,
86, -56, 47, 119, -106, 20 }));
DocumentBuilder documentBuilder = i.b();
Document document = documentBuilder.parse(inputStream);
cyz.a(document);
Element element = document.getDocumentElement();
Node node1 = element.getElementsByTagName(d.a(new byte[] {
-4, -113, -63, 2, -55, -40, -49, 47, -58, 69,
36, 9, -43, -60, 20 })).item(0);
Node node2 = element.getElementsByTagName(d.a(new byte[] {
-49, -108, -14, -114, -118, 22, -34, 34, 96, 37,
42, -124, 20 })).item(0);
if (node1 != null && node2 != null && a(cyz.a(node1), node2.getLastChild().getNodeValue(), true, false)) {
ArrayList<String> arrayList = new ArrayList();
NodeList nodeList = node1.getChildNodes();
if (nodeList != null)
for (byte b = 0; b < nodeList.getLength(); b++) {
if (nodeList.item(b).getNodeName().equals(d.a(new byte[] { -89, -122, -2, 55, 124, -120, 62, 102, -76, 20 }))) {
Node node = nodeList.item(b).getLastChild();
arrayList.add((node == null) ? "" : node.getNodeValue());
}
}
return arrayList;
}
} catch (CellsException cellsException) {
this.b = cellsException.getMessage();
} catch (Exception exception) {
this.b = d.a(new byte[] {
-122, 56, -64, 40, 19, -65, -70, -40, 86, -44,
95, 54, 95, 84, 2, 22, -52, 69, -92, 62,
31, 21, -72, -122, 30, -20, 16, 21, 116, 81,
-102, 93, -108, 49, -44, 68, 31, 22, 56, 103,
-47, 18, 93, -12, 4, 76, 17, 123, 23, 31,
21, 120, 60, -52, 1, 17, -108, -126, Byte.MIN_VALUE, -42,
-72, 56, 22, -96, -75, 85, 116, 41, -110, 87,
126, 17, -76, 119, 116, -38, 23, 22, -52, 113,
-124, 6, 52, 76, 25, 113, -114, 17, -67, -69,
31, 21, 57, 26, 20, -52, 76, 31, 113, 87,
98, -96, 56, 22, -93, -66, 22, 116, -44, -112,
-94, 67, -70, -84, 22, -56, 20 });
}
return null;
}
private static void a(String[] paramArrayOfString) {
String str = l.c;
if (str != null)
for (byte b = 0; b < paramArrayOfString.length; b++) {
if (str.equals(paramArrayOfString))
return;
}
throw new CellsException(9, d.a(new byte[] {
19, -73, 73, 55, -66, 84, -80, 86, -44, 111,
8, -121, 20, 95, -108, -106, -44, 63, 94, 0,
2, 21, -49, -124, 2, 31, 21, 120, 33, 84,
-96, 24, 56, 23, -89, 53, 44, 2, 22, 78,
8, 21, -92, -92, 10, -45, 33, -8, 24, -107,
4, -93, 20 }));
}
}
3、适配的Licence.xml
<License>
<Data>
<Products>
<Product>Aspose.Cells for Java</Product>
<Product>Aspose.Excel for Java</Product>
</Products>
<EditionType>Enterprise</EditionType>
<SubscriptionExpiry>20991231</SubscriptionExpiry>
<LicenseExpiry>20991231</LicenseExpiry>
<SerialNumber>Locus</SerialNumber>
<OemPublicKeyToken>Locus</OemPublicKeyToken>
</Data>
<Signature>Locus</Signature>
</License>
修改了两个类里面的方法,原理就是把验证的方法返回true,取时间的方法给个远期时间。
有需要可以把原始JAR反编译进行对比,也可以把上面两个类放进去直接替换。
修改后的jar和编译好的class已上传,附件地址:
由于未知原因,于10月29日改成7天有效期链接,后续有需要的可以留言度盘收集,也可以找之前的兄弟要
通过网盘分享的文件:JAVA-Aspose.Excel-24.7
链接: https://pan.baidu.com/s/1zr-3Nq8YrdqHLe36MONA3Q?pwd=52pj 提取码: 52pj
该版本仅限大家研究讨论,请勿传播或进行二次售卖。 太强了大佬可以同时把同版本的其他组件也做一下嘛 好东西 收藏备用 大佬 有psd的吗 lnastacies 发表于 2024-10-24 10:52
已更新,好用给个赞再走吧
老哥,网盘过期了,可以更新一下吗 大佬,你好。网盘连接过期了,可以更新一下嘛 大佬,链接失效了。可以补发一下吗 valve117 发表于 2024-10-30 14:49
好的,正常了,万分感谢大佬
能分享一下吗?链接过期了。 好的,正常了,万分感谢大佬 liuseda 发表于 2024-10-29 16:25
太强了大佬可以同时把同版本的其他组件也做一下嘛
什么?{:1_911:}人家卖几W一套的商业产品,仅供学习交流 本帖最后由 lnastacies 于 2024-10-24 11:18 编辑
valve117 发表于 2024-10-14 11:05
package org.example;
import java.io.File;//校验license
private static boolean judgeLicense() {
boolean result = false;
try (InputStream is = Files.newInputStream(Paths.get("file/config/license.xml"))) {
License aposeLic = new License();
aposeLic.setLicense(is);
result = true;
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
private static void excelToPdf(String oPath, File toPdf, String logoPng, String headLeftText, String headRightText, String isPage) {
if (!judgeLicense()) {
System.out.println("license文件读取错误");
} else {
try (FileOutputStream os = new FileOutputStream(toPdf)) {
Workbook wb = new Workbook(oPath);
// // 获取第一个工作表
Worksheet worksheet = wb.getWorksheets().get(0);
PageSetup ps = worksheet.getPageSetup();
/**
* 添加pdf的页眉和页脚
*/
// 页眉
if (logoPng != null) {
File fLogo = new File(logoPng);
if (fLogo.exists()) {
FileInputStream fis = new FileInputStream(fLogo);
byte[] binaryLogo = new byte[(int) fLogo.length()];
int bytesRead = fis.read(binaryLogo);
if (bytesRead != -1) {
// 文件内容现在存储在fileContent字节数组中
System.out.println("页眉Logo内容已全部读取完成!");
}
ps.setHeaderPicture(0, binaryLogo);
ps.setHeader(0, "&G");
fis.close();
}
} else {
ps.setHeader(0, headLeftText);
}
if (headRightText != null) {
ps.setHeader(2, headRightText);
}
if (isPage != null && isPage.equals("Y")) {
// 页脚
ps.setFooter(1, "&P/&N");
}
PdfSaveOptions options = getSaveOptions(isPage);
wb.save(os, options);
} catch (Exception e) {
e.printStackTrace();
}
}
}