0

I am currently extracting the Pin List - Pin Names in Altium Designer that uses DelphiScript (not Delphi). DelphiScript and Delphi has differences and I believe one of them is the file I/O component. According to the Altium Docs for DelphiScript, only text files and csv files can be produced. In producing an output file .csv, saving is as easy as throwing text that are comma delimited and then saving with an extension '.csv'. My problem now is how to create a .xls file without importing and/or downloading plugins/extensions like eDocEngine VCL, LibXL, TQExport4Xlsx. Tried declaring TBook, TSheet, TgtXLSEngine or other ways to create the spreadsheet but error says it is an undeclared identifier. Do you guys have any idea?

Report Writer Code Snippet:


Procedure BeginReportPinList(AFilename: String);
Begin
    gv_FileName := AFilename + '.csv'; 
    AssignFile(gv_FileReport, gv_FileName);
    Rewrite(gv_FileReport);
End;

Procedure WriteReportDUT(AReport : String);
Begin
    WriteLn(gv_FileReport, Format('%s', [AReport]));
End;

Procedure EndReport(Dummy : Boolean);
Begin
    CloseFile(gv_FileReport);
End;


String Parser Code Snippet that calls above procedures:

if dutlistX.Count = 1 then
       Begin

            PinFilename := copy(gv_Board.FileName, 1, Pos('-05', gv_Board.FileName)-1) + '-14';
            BeginReportPinList(PinFilename);

            For I := 0 To finalreport.Count - 1 Do
                Begin
                     WriteReportDUT(finalreport[I]);
                End;

            EndReport(0);
      End;
  • Welcome to Stack Overflow! Can you please elaborate your question having your effort like code or something so that people could get your problem early and help you? Thanks! – Enamul Hassan Aug 23 '16 at 01:30
  • DelphiScript does not include native support for creating .XLS files. If you want to do so, you'll need to use third-party components. Just declaring a type doesn't magically add support for the file format. (And don't just dump a bunch of code in a comment. If you have information to add, [edit] your question and add it there.) – Ken White Aug 23 '16 at 02:39
  • Hi, @KenWhite Yes actually I deleted my previous comment that contains the jumbled code I pasted. I am new to Stack Overflow and still learning on how to paste lines of code in here. Thanks for confirming that DelphiScript needs to use 3rd party components to be able to generate an XLS file. – Raray Enriquez Aug 23 '16 at 02:48

1 Answers1

0

As was mentioned in comments by @Ken White, it is very difficult to do this without third-party components. As far as I know, XSL file has a structure of Compound File Binary Format. This type of files consisting of blocks and streams that You can manipulate. I have used this third-party software to parse such file type (actually SchDoc, but not XLS), check this question. OpenMCDF can do a trick if You have Altium running with .NET platform, like 16 version do, for example. In addition, You may use the specification of this file format based on CFB.

It is very noticeable, that some other filetypes of Altium is using that CFB file format, so it might be useful to know about OpenMCDF. I believe that XLS can be created in much handy way, than this one, but it is useful to know, how to deal with such data containers, as XLS, or SchDoc, et cetera.

Community
  • 1
  • 1