Avoiding FieldStartDelimiter and FieldEndDelimiter?

rocopsa
rocopsa Member Posts: 38
Dear experts,

I'm developing export function into TXT (Tab Delimit) files and encounter a problem.

Since I have a field having length over 250, I can neither use dataport nor ExcelBuff. So, I have created a codeunit and written all the necessary CreateBook, CreateSheet, SaveAs .TXT codes, etc by myself.

It was fine and successful BUT.... the output data includes a doublequot (") at the start and end of the field value which having comma (,). That's the problem I am encountering.

The SaveAs code as follows:
XlWrkBk.SaveAs(<full file path name>,-4158);
In which, -4158 is xlFileFormat - xlCurrentPlatformText.

Actually, I have tried other Text fileformat but in vain.
19, 20, 21, 42 - all error;
36 Printer Text can avoid the double quotation, BUT,..... did not use TAB as delimiter.

So, if any one of you have ideas on that, please kindly advise! [-o<

Thanks in advance,
Rocopsa

Answers

  • MBerger
    MBerger Member Posts: 413
    Maybe you should look into writing the file yourself using File and Outstream, instead of relying on Excel to do it for you. It'll be a little bit more work, but you are in control of what you want to output.
  • einsTeIn.NET
    einsTeIn.NET Member Posts: 1,050
    In Excel, if you use Data -> Import External Data -> Import Data, then on the second page of the wizard you can define what field value delimiter to use.
    "Money is likewise the greatest chance and the greatest scourge of mankind."
  • MBerger
    MBerger Member Posts: 413
    In Excel, if you use Data -> Import External Data -> Import Data, then on the second page of the wizard you can define what field value delimiter to use.
    i think he is using Excel to export a textfile, seeing he's using XlWrkBk.SaveAs
  • rocopsa
    rocopsa Member Posts: 38
    Dear all,

    Thanks for the idea!!! I will try to look into FILE and outstream instead.
    \:D/


    Cheers!
    Rocopsa