Back to Devexpress

ISpreadsheetComponent.SaveDocument(String) Method

officefileapi-devexpress-dot-spreadsheet-dot-ispreadsheetcomponent-dot-savedocument-x28-system-dot-string-x29.md

latest4.7 KB
Original Source

ISpreadsheetComponent.SaveDocument(String) Method

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Saves the document to the specified file. The file format is identified by the file extension.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
void SaveDocument(
    string fileName
)
vb
Sub SaveDocument(
    fileName As String
)

Parameters

NameTypeDescription
fileNameString

A string value specifying the path to a file in which to save the document.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveDocument(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-spreadsheetcontrol-api-part-3/CS/SpreadsheetControl_API_Part03/CodeExamples/CustomXmlPartActions.cs#L36

csharp
workbook.CustomXmlParts.Add(xmlDoc);
workbook.SaveDocument("Documents\\CustomXmlTest.xlsx");
System.IO.File.Copy("Documents\\CustomXmlTest.xlsx", "Documents\\CustomXmlTest.xlsx.zip", true);

wpf-spreadsheetcontrol-api-part-2/CS/SpreadsheetControl_WPF_API_Part02/SpreadsheetActions/CustomXmlPartActions.cs#L41

csharp
workbook.CustomXmlParts.Add(xmlDoc);
workbook.SaveDocument("Documents\\CustomXmlTest.xlsx");
System.IO.File.Copy("Documents\\CustomXmlTest.xlsx", "Documents\\CustomXmlTest.xlsx.zip", true);

spreadsheet-document-api-examples-part2/CS/SpreadsheetDocServerAPIPart2/CodeExamples/CustomXmlPartActions.cs#L83

csharp
foreach (XmlNode node in xmlNodes) node.InnerText = "Stephen";
workbook.SaveDocument("..\\..\\..\\Documents\\CustomXmlRogerStephen.xlsx");
workbook.Worksheets[0].Cells["A2"].Value = xmlDoc.FirstChild.FirstChild.FirstChild.InnerText;

winforms-spreadsheetcontrol-api-part-3/VB/SpreadsheetControl_API_Part03/CodeExamples/CustomXmlPartActions.vb#L32

vb
workbook.CustomXmlParts.Add(xmlDoc)
workbook.SaveDocument("Documents\CustomXmlTest.xlsx")
System.IO.File.Copy("Documents\CustomXmlTest.xlsx", "Documents\CustomXmlTest.xlsx.zip", True)

spreadsheet-document-api-examples-part2/VB/SpreadsheetDocServerAPIPart2/CodeExamples/CustomXmlPartActions.vb#L80

vb
Next node
workbook.SaveDocument("..\..\..\Documents\CustomXmlRogerStephen.xlsx")
workbook.Worksheets(0).Cells("A2").Value = xmlDoc.FirstChild.FirstChild.FirstChild.InnerText

See Also

LoadDocument

ISpreadsheetComponent Interface

ISpreadsheetComponent Members

DevExpress.Spreadsheet Namespace