* * *

Author Topic: Ho i can link tabwork with sheet on document  (Read 516 times)

eldonfsr

  • Full Member
  • ***
  • Posts: 116
Ho i can link tabwork with sheet on document
« on: October 07, 2017, 12:56:13 am »
Hello friends i can open a workfile but i dont get when i change of tab to the sheet in document still on the same sheet, i can open the example come with pfspread ask me for Tfonstyleaction unit i dont found this file on source code, home can help me thanks.
Code: Pascal  [Select]
  1.  if Odlg.Execute then  begin
  2.      sWorkbookSource1.FileName :=ODLG.FileName;
  3.        sworksheetGrid1.WorkbookSource.FileName:=ODLG.FileName;
  4.  if sworksheetGrid1.Visible = false then sworksheetGrid1.Visible:=true;
  5.      FExcFile.Text :=oDlg.FileName;
  6.           end;                            
  7.  

wp

  • Hero Member
  • *****
  • Posts: 3956
Re: Ho i can link tabwork with sheet on document
« Reply #1 on: October 07, 2017, 10:33:56 am »
Sorry, I don't understand. Please post your question in your native language, maybe somebody else can translate it for me.

TsFontStyleAction is in unit fspActions.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

eldonfsr

  • Full Member
  • ***
  • Posts: 116
Re: Ho i can link tabwork with sheet on document
« Reply #2 on: October 07, 2017, 09:23:32 pm »
well thanks for your replay

after work some time with this packages i got works for me what i do and what i understand is.

1.-  Workseetbook must be a put it in the component wsworkseet and wstabworksheet
      at property workbooksource
      reference to workbook
2.- When you open a file we need to open like this
Code: Pascal  [Select]
  1.  ODlg.Filter:='All spreadsheet files|*.xls;*.xlsx;*.ods;*.csv|All Excel files (*.xls, *.xlsx)|*.xls;*.xlsx|Excel XML spreadsheet (*.xlsx)|*.xlsx|Excel 97-2003 spreadsheets (*.xls)|*.xls|Excel 5 spreadsheet (*.xls)|*.xls|Excel 2.1 spreadsheets (*.xls)|*.xls|LibreOffice/OpenOffice spreadsheet (*.ods)|*.ods|Comma-delimited files (*.csv)|*.csv';
  2.   sWorkbookSB.AutoDetectFormat := true;
  3.   sWorkbookSB.AutoDetectFormat := true;
  4.   if Odlg.Execute then   begin
  5.  
  6.        sWorkbookSB.FileName :=ODLG.FileName;
  7.        sworksheetGrid1.WorkbookSource.FileName:=sWorkbookSB.FileName;
  8.  
  9.   if sworksheetGrid1.Visible = false then sworksheetGrid1.Visible:=true;
  10.      FExcFile.Text :=oDlg.FileName;
  11.   end;      
  12.  
first assign the file to open to the workbook
second assign the file workbook.filename to worksheet
 
this way all work fine
sorry but how i can't open the test file i made some mistakes.

thanks for you help.

wp

  • Hero Member
  • *****
  • Posts: 3956
Re: Ho i can link tabwork with sheet on document
« Reply #3 on: October 07, 2017, 11:06:00 pm »
Code: Pascal  [Select]
  1.        sWorkbookSB.FileName :=ODLG.FileName;
  2.        sworksheetGrid1.WorkbookSource.FileName:=sWorkbookSB.FileName;

One time is enough... You probably did not select the fileformat to be loaded and you probably forgot to add the unit with the file reader/writer to "uses" (or: use unit fpsAllFormats).

In the attachment there is a simple demo which illustrates how to load a LibreOffice test file into the grid. All required parameters are set here in code to show you what you must do. Of course you can set these parameters also in the Object Inspector at designtime.
Lazarus trunk / fpc 3.0.4 / all 32-bit on Win-10

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus