officefileapi-devexpress-dot-spreadsheet-dot-ispreadsheetcomponent-dot-savedocument-x28-system-dot-string-x29.md
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
void SaveDocument(
string fileName
)
Sub SaveDocument(
fileName As String
)
| Name | Type | Description |
|---|---|---|
| fileName | String |
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.
workbook.CustomXmlParts.Add(xmlDoc);
workbook.SaveDocument("Documents\\CustomXmlTest.xlsx");
System.IO.File.Copy("Documents\\CustomXmlTest.xlsx", "Documents\\CustomXmlTest.xlsx.zip", true);
workbook.CustomXmlParts.Add(xmlDoc);
workbook.SaveDocument("Documents\\CustomXmlTest.xlsx");
System.IO.File.Copy("Documents\\CustomXmlTest.xlsx", "Documents\\CustomXmlTest.xlsx.zip", true);
foreach (XmlNode node in xmlNodes) node.InnerText = "Stephen";
workbook.SaveDocument("..\\..\\..\\Documents\\CustomXmlRogerStephen.xlsx");
workbook.Worksheets[0].Cells["A2"].Value = xmlDoc.FirstChild.FirstChild.FirstChild.InnerText;
workbook.CustomXmlParts.Add(xmlDoc)
workbook.SaveDocument("Documents\CustomXmlTest.xlsx")
System.IO.File.Copy("Documents\CustomXmlTest.xlsx", "Documents\CustomXmlTest.xlsx.zip", True)
Next node
workbook.SaveDocument("..\..\..\Documents\CustomXmlRogerStephen.xlsx")
workbook.Worksheets(0).Cells("A2").Value = xmlDoc.FirstChild.FirstChild.FirstChild.InnerText
See Also