GdPicture.NET.14
GdPicture14 Namespace / GdPictureDocumentConverter Class / SaveAsXLSX Method / SaveAsXLSX(Stream) Method
A stream object where the current document is saved to as a XLSX file. This stream object must be initialized before it can be sent into this method and it should stay open for subsequent use.

If the output stream is not opened for both reading and writing, the method will fail returning the GdPictureStatus.InvalidParameter status.

Example





In This Topic
SaveAsXLSX(Stream) Method
In This Topic
This method converts the currently loaded document to XLSX and saves it to an instantiated stream object.
Syntax
'Declaration
 
Public Overloads Function SaveAsXLSX( _
   ByVal Stream As Stream _
) As GdPictureStatus
public GdPictureStatus SaveAsXLSX( 
   Stream Stream
)
public function SaveAsXLSX( 
    Stream: Stream
): GdPictureStatus; 
public function SaveAsXLSX( 
   Stream : Stream
) : GdPictureStatus;
public: GdPictureStatus SaveAsXLSX( 
   Stream* Stream
) 
public:
GdPictureStatus SaveAsXLSX( 
   Stream^ Stream
) 

Parameters

Stream
A stream object where the current document is saved to as a XLSX file. This stream object must be initialized before it can be sent into this method and it should stay open for subsequent use.

If the output stream is not opened for both reading and writing, the method will fail returning the GdPictureStatus.InvalidParameter status.

Return Value

A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK.
Remarks
Keep noted that the output stream should be open for both reading and writing and should be closed/disposed by the user as well.
Example
Converting and saving a PDF document to a XLSX file using a stream.
using GdPicture14;
            
using GdPictureDocumentConverter converter = new();
            
var status = converter.LoadFromFile("input.pdf");
if (status != GdPictureStatus.OK)
{
    throw new Exception(status.ToString());
}
            
using var fs = new FileStream("output.xlsx", FileMode.OpenOrCreate, FileAccess.ReadWrite);
            
status = converter.SaveAsXLSX(fs);
if (status != GdPictureStatus.OK)
{
    throw new Exception(status.ToString());
}
            
Console.WriteLine("The input document has been converted to a xlsx file");
See Also