I'm not using any dataport object.
I'm looking for the same result from my custom made codeunit which I want to fire through NAS.
My code is given below:
// Start Code
StrWhere:='=';
StrWhich:=',"';
FilePath :='D:\';
Location.RESET;
IF Location.FIND('-') THEN BEGIN
IF NOT CREATE(XlApp,TRUE,FALSE) THEN
ERROR('Excel Not Found.');
I :=1;
xlBook := XlApp.Workbooks.Add(-4167);
xlSheet:= XlApp.ActiveSheet;
xlSheet.Range('A'+FORMAT(I)).Value :=
'Factory_Code|"Factory_Name"|"Factory_Address"|'+
'"Factory_Address2"|"Factory_City_Name"|"Factory_State_Code"|'+
'"Factory_Is_Active"|"Owner_Name"|"TIN_No"|"EMail"|"Factory_Master_Code"';
REPEAT
Found1:=TRUE;
I :=I+1;
xlSheet.Range('A'+FORMAT(I)).Value :=
FORMAT(DELCHR(Location.Name,StrWhere,StrWhich))+
'|'+FORMAT(DELCHR(Location.Address,StrWhere,StrWhich))+'"'+
'|'+FORMAT(DELCHR(Location."Address 2",StrWhere,StrWhich))+'"'+
'|'+FORMAT(DELCHR(Location.City,StrWhere,StrWhich))+'"'+
'|'+FORMAT(DELCHR(Location."State Code",StrWhere,StrWhich))+'"'+
'|'+FORMAT(TRUE)+'"'+
'|'+FORMAT(DELCHR(Location.Contact,StrWhere,StrWhich))+'"'+
'|'+FORMAT(DELCHR(Location."T.I.N. No.",StrWhere,StrWhich))+'"'+
'|'+FORMAT(DELCHR(Location."E-Mail",StrWhere,StrWhich))+'"'+
'|'+FORMAT(Location.Code)+'"';
UNTIL Location.NEXT =0;
END;
IF Found1 THEN BEGIN
XlApp.Visible := FALSE;
XlApp.DisplayAlerts := FALSE;
xlBook.Activate;
xlBook.SaveAs(FilePath+FORMAT(TODAY,0,5)+'_'+FORMAT(TIME,0,2)+'.csv',6);
xlBook.Close; //To Close the Excel
CLEAR(XlApp);
CLEAR(xlBook);
END;
// End Code
The generated csv files looks(excel view) exactly which I want to create but when I open it in notepad mode a extra double quotes are found.
I don't want this extra double quote.