PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Saves the content of a Spreadsheet control in a file in XLSX format.
Example
// Save the current file
SpreadsheetSave(PSHEET_Spreadsheet, "Workbook1.XLSX")
// Load the file
SpreadsheetLoad(PSHEET_NoName1, "test.xlsx")
// Modify the file
PSHEET_NoName1["A","1"] = "modified"
// Save under a different name
// The "text1.xlsx" file already exists
IF SpreadsheetSave(PSHEET_NoName1, "test1.xlsx") = False THEN
// Before version 200051, the existing xlsx file is overwritten.
// From version 200051, the existing xlsx file is not modfified.
// The function returns False and an error
// To overwrite the file, use the psheetOverwriteAllowed constant
Error("File not saved " + ErrorInfo()
ELSE
Info("File saved")
END
Syntax
<Result> = SpreadsheetSave(<Spreadsheet Control> , <File to Save> [, <Option>])
<Result>: Boolean
  • True if the file of Spreadsheet control was saved,
  • False otherwise. ErrorInfo returns more details about the error.
<Spreadsheet Control>: Control name
Name of Spreadsheet control to use.
<File to Save>: Character string (with quotes)
Name and full path of XLSX file where the content of Spreadsheet control will be saved.
<Option>: Optional Integer constant
Mode for saving the file if the XLSX file already exists:
0 (or nothing)
(Default behavior)
If the XLSX file already exists and if it is not opened (in the Spreadsheet control or in another application), it is not saved.
psheetOverwriteAllowedIf the XLSX file already exists and if it is not opened (in the Spreadsheet control or in another application), it is overwritten.
Caution: This parameter is available from version 200051. If you are using an earlier version, the existing XLSX file that is not opened is overwritten by default.
Remarks
  • To open the ".xlxs" file saved with another application, it must be closed by SpreadsheetClose.
  • The saved file can be reloaded in a Spreadsheet control via SpreadsheetLoad and xlsOpen.
  • This function can only be used on a Spreadsheet control found in a window.
  • Versions 23 and later
    SpreadsheetSave updates the ..FilePath property of Spreadsheet control by associating the name of loaded file to the Spreadsheet control.
    New in version 23
    SpreadsheetSave updates the ..FilePath property of Spreadsheet control by associating the name of loaded file to the Spreadsheet control.
    SpreadsheetSave updates the ..FilePath property of Spreadsheet control by associating the name of loaded file to the Spreadsheet control.
Related Examples:
The Spreadsheet control Unit examples (WINDEV): The Spreadsheet control
[ + ] Using the Spreadsheet control.
This example explains how to:
- load an xlsx file in a spreadsheet control,
- save the spreadsheet in a file,
- fill the control with data coming from the database,
- insert rows, columns,
- access the cells and handle them (modify their value, their style, ...),
- enter formulas,
- ...
Components
WINDEVReports and Queries wd230obj.dll
Minimum required version
  • Version 20
This page is also available for…
Comments
Click [Add] to post a comment