Guys i need some help here , im getting this error here at the code snippet below. here's the stack trace. i have a feeling that somebody's gonna say not much effort on my part. its ok i agree , give me a suggestion what should i do more and ill do it just that i've got a little stuck and not moving ahead so thought of posting it here.
i think i'm having a problem because i'm using a code that was used for writing an excel file when the size of content to write to excel was pre - known . what i actually need is some way to write to excel when the length of rows and collumns may vary .
Length of Array:2000
java.lang.NullPointerException
at org.temp2.cod2.WriteToExcel.setExcel(WriteToExcel.java:149) >> line 149 is last line of the code snippet below i.e. byte buf[] = s.getBytes();
here the code snippet
String data[][] = new String [2000][5];
System.out.println("Length of Array:"+data.length);
for(int j=0;j<colN.length;j++){
Label myLabel1=new Label(j,1,colVal[j]);
wst.addCell(myLabel1);
}
for(int i=2;i<=data.length+1;i++){
for(int j=0;j<colN.length;j++)
{
// Encrypt
encrypter.encrypt(new FileInputStream("C:\\Users\\abc\\Desktop\\Encrypted.txt"),new FileOutputStream("temp.txt"));
// Decrypt
ByteArrayOutputStream f = new ByteArrayOutputStream();
String s = data[i-2][j];
byte buf[] = s.getBytes();