/*
* To change this license header, choose License Headers in Project Properti
es.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package javaapplication4;
/**
*
* @author india
*/
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import jxl.*;
import [Link].*;
import [Link];
import [Link];
import [Link];
import [Link].*;
import [Link];
import [Link];
import [Link];
import
import
import
import
import
[Link];
[Link];
[Link];
[Link];
[Link];
public class XlsReader1 {
public static void main(String[] args)
throws BiffException, IOException, WriteException
{
//[Link]("in");
Workbook dataWorkbook = [Link](new File("[Link]"));//xsl
workbook
Sheet dataSheet = [Link](0);
Cell cpromoId = [Link](8,1);//promo id
String promoId = [Link]();
//[Link]("str1 "+promoId);
Workbook checkWorkbook = [Link](new File("[Link]"));//x
ml workbook
Sheet checkSheet = [Link](0);
Cell ccheckCell = [Link](13,1);//chk sheet id5 col.. promo i
d match
String checkCell = [Link]();
//[Link]("str3 "+checkCell);
//****** records Adding **************//
//** records from data sheet**//
//** records of promo id**//
ArrayList<String> arrPid = new ArrayList<String>(20000);//arraylist to s
tore Promo id values
Cell[] cellColumnPid = [Link](8);//cell col array
int cellCountpid = [Link];
cellCountpid--;
//[Link]("cells in col: " + cellCountpid);
int cellCount2 = cellCountpid;
int i = 1;
while(cellCountpid != 0)
{
//Sheet sh4 = [Link](0);
Cell cell4 = [Link](8,i);//to get the promo id values in cell
String str4 = [Link]();
//[Link](str4);
[Link](str4);
cellCountpid--;
i++;
}
//** records of th.**//
ArrayList<String> arrTh = new ArrayList<String>(20000);//arraylist to st
ore Promo id values
Cell[] cellColumnTh = [Link](5);//cell col array
int cellCountTh = [Link];
cellCountTh--;
//[Link]("cells in col: " + cellCountTh);
int cellCount5 = cellCountTh;
int i1 = 1;
while(cellCountTh != 0)
{
Cell cell5 = [Link](5,i1);//to get the promo id values in cel
l
String str5 = [Link]();
//[Link](str5);
[Link](str5);
cellCountTh--;
i1++;
}
//** records of offer**//
ArrayList<String> arrOff = new ArrayList<String>(20000);//arraylist to s
tore Promo id values
Cell[] cellColumnOff = [Link](6);//cell col array
int cellCountOff = [Link];
cellCountOff--;
//[Link]("cells in col: " + cellCountOff);
int cellCount6 = cellCountOff;
int i2 = 1;
while(cellCountOff != 0)
{
Cell cell6 = [Link](6,i2);//to get the promo id values in cel
l
String str6 = [Link]();
// [Link](str6);
[Link](str6);
cellCountOff--;
i2++;
}
//*** records from check xml**//
//**adding records from ID5**//
//[Link]("printing id5");
ArrayList<String> arrId5 = new ArrayList<String>(50000);//id5 is col nam
e
Cell[] cellColumnid5 = [Link](13);//cell col array
int cellCountid5 = [Link];
cellCountid5--;
//[Link]("cells in col: " + cellCountid5);
int cellCount3 = cellCountid5;
int j = 1;
while(cellCountid5 != 0)
{
Cell cell5 = [Link](13,j);//to get the promo id values in ce
ll
String str5 = [Link]();
// [Link](str5);
[Link](str5);
cellCountid5--;
j++;
}
//**adding records from QTY8**//
// [Link]("printing qty8");
ArrayList<String> arrQty = new ArrayList<String>(50000);//id5 is col nam
e
Cell[] cellColumnQty = [Link](28);//cell col array
int cellCountQty = [Link];
cellCountQty--;
//[Link]("cells in col: " + cellCountQty);
int cellCount7 = cellCountQty;
int j1 = 1;
while(cellCountQty != 0)
{
// [Link]("m here");
Cell cell7 = [Link](28,j1);//to get the promo id values in c
ell
String str7 = [Link]();
// [Link](str7);
[Link](str7);
cellCountQty--;
j1++;
}
//**adding records from Discount Percent**//
//[Link]("printing disc");
ArrayList<String> arrDisc = new ArrayList<String>(50000);//id5 is col na
me
Cell[] cellColumnDisc = [Link](29);//cell col array
int cellCountDisc = [Link];
cellCountDisc--;
//[Link]("cells in col: " + cellCountDisc);
int cellCount8 = cellCountDisc;
int j2 = 1;
while(cellCountDisc != 0)
{
Cell cell8 = [Link](29,j2);//to get the promo id values in c
ell
//
String str8 = [Link]();
[Link](str8);
[Link](str8);
cellCountDisc--;
j2++;
}
//**ended record adding in arraylists
//[Link]("done");
//to compare the first sheet's records with second sheet. one by one
int x = cellCount3;
int y = 0;
//ArrayList<String> matchId5 = new ArrayList<String>(20000);
ArrayList<String> resultPid = new ArrayList<String>(20000);
int r1 = 0;
String[] arrstr1 = new String[20000];
String[] arrstr2 = new String[20000];
String[] arrstr3 = new String[20000];
String[] arrstr4 = new String[20000];
String[] arrstr5 = new String[20000];
String[] arrstr6 = new String[20000];
String[] arrstr7 = new String[20000];
//to match the records of pid
do
{
cellCount2--;
//
cellCount5--;
//
cellCount6--;
//[Link]("cellcount2 " + cellCount2);
cellCount3 = x;
do
{
cellCount3--;
//
cellCount7--;
//
cellCount8--;
[Link]("cellcount3 " + cellCount3);
// && [Link](cellCount2).equals([Link](cellCount3)) && arrOff.
get(cellCount2).equals([Link](cellCount3))
if([Link](cellCount2).equals([Link](cellCount3))&& [Link](cel
lCount2).equals([Link](cellCount3)) && [Link](cellCount2).equals(arrDisc
.get(cellCount3)))
{
//if([Link](cellCount2).equals([Link](cellCount3)))
[Link]("2 if");
{
//.isEmpty() &&
//if([Link](cellCount2).contains([Link](cellCount3)))
{
Cell cell9 = [Link](27,cellCount3);//to get the promo id val
ues in cell
String str9 = [Link]();
arrstr1[cellCount2] = str9;
Cell cell12 = [Link](8,cellCount2);//to get the promo id valu
es in cell
String str12 = [Link]();
arrstr2[cellCount2] = str12;
Cell cell13 = [Link](5,cellCount2);//to get the promo id valu
es in cell
String str13 = [Link]();
arrstr3[cellCount2] = str13;
[Link]("arrstr3");
Cell cell14 = [Link](6,cellCount2);//to get the promo id valu
es in cell
String str14 = [Link]();
arrstr3[cellCount2] = str14;
Cell cell15 = [Link](13,cellCount2);//to get the promo id val
ues in cell
String str15 = [Link]();
arrstr4[cellCount2] = str15;
Cell cell16 = [Link](28,cellCount2);//to get the promo id val
ues in cell
String str16 = [Link]();
arrstr5[cellCount2] = str16;
[Link]("arrstr6");
Cell cell17 = [Link](29,cellCount2);//to get the promo id val
ues in cell
String str17 = [Link]();
arrstr6[cellCount2] = str17;
//
//
//
//
//
//
//
//
//[Link](str9);
String str7 = [Link](cellCount2);
//[Link]("str9 "+[Link](r1));
//r1++;
[Link]("value y" +y);
}
}
}
//[Link]("out1");
} while(cellCount3 !=0);
[Link]("out2");
} while(cellCount2 !=0);
[Link]("out3");
int i10 = 1;
for(String Str11 : resultPid)
{
[Link]("resultpid "+Str11);
[Link]("Count "+i10);
i10++;
}
[Link]();
[Link]();
[Link]();
[Link]();
//adding values in csv file
//BufferedReader addedBuffer = new BufferedReader(new FileReader(add
[Link]()));
try{
File outputFile = new File("[Link]");
BufferedWriter newFileBuffer = new BufferedWriter(new FileWriter(out
putFile));
if([Link]())
{
[Link]();
[Link]();
}
else{
[Link]();
}
}
catch(IOException e)
{
[Link]();
}
//
//
//
//
//
//
//
//
//
//
//
//
//
for(String str10 : resultPid)
{
[Link](str10);
[Link]();
}
}
[Link]();
}
catch (FileNotFoundException ex) {
[Link](ex);
}
[Link]("arr2length" +[Link]);
try
{ [Link]("writing");
FileWriter writer = new FileWriter("[Link]");
[Link]("PromoId");
[Link](',');
[Link]("Quantity");
[Link](',');
[Link]("Discount");
[Link](',');
[Link]("SourceId");
[Link]('\n');
for(int count = 0; i<[Link]; count++)
{
[Link]("arrstr2 "+arrstr2[count]);
[Link](arrstr2[count]);
[Link](',');
[Link](arrstr3[count]);
[Link](',');
[Link](arrstr4[count]);
[Link](',');
[Link](arrstr1[count]);
[Link]('\n');
}
//
//
//
//
//
//
//
for(String strRead : resultPid)
{
[Link](strRead);
//[Link](',');
//[Link]("Age");
[Link]('\n');
}
[Link]();
[Link]();
}
catch(IOException e)
{
[Link]();
}
//[Link]("excel closed");
}
}