C_SaveSpreadsheetMem

Call C_SaveSpreadsheetMem to save a spreadsheet to memory.

void C_SaveSpreadsheetMem(

TOrcFxAPIHandle ObjectHandle,

int SpreadsheetType,

int SpreadsheetFileType,

void *lpParameters,

TOrcFxAPIHandle *lpBufferHandle,

int64_t *lpBufferLen,

int *lpStatus

);

Parameters

ObjectHandle (IN)

See the ObjectHandle parameter of C_SaveSpreadsheet.

SpreadsheetType (IN)

See the SpreadsheetType parameter of C_SaveSpreadsheet.

SpreadsheetFileType (IN)

One of sftCsv, sftTab or sftXlsx, to indicate the format used to save the spreadsheet.

lpParameters (IN)

See the lpParameters parameter of C_SaveSpreadsheet.

lpBufferHandle (OUT)

Points to a variable in which a handle to the saved buffer will be returned.

lpBufferLen (OUT)

Points to a variable in which the length of the saved buffer will be returned.

lpStatus (OUT)

Points to a variable in which the status result for the function call will be returned.

Remarks

In order to extract the contents of the buffer, you must follow the call to C_SaveSpreadsheetMem with calls to C_CopyBuffer and C_FreeBuffer. Use the value returned in lpBufferLen to allocate a suitably sized buffer. Pass this to C_CopyBuffer to perform the copy. Finally, call C_FreeBuffer to free the buffer handle.

Such code typically looks like this:

TOrcFxAPIHandle BufferHandle;

int64_t BufferLen;

int Status;

C_SaveSpreadsheetMem(ObjectHandle, SpreadsheetType, SpreadsheetFileType, &Parameters, &BufferHandle, &BufferLen, &Status);

unsigned char *lpBuffer = new unsigned char[BufferLen];

C_CopyBuffer(BufferHandle, lpBuffer, BufferLen, &Status);

C_FreeBuffer(BufferHandle, &Status);

// use lpBuffer

delete[] lpBuffer;

Note that, for the sake of brevity, error checking has been omitted from the above code.

See also

C_CopyBuffer, C_FreeBuffer, C_SaveSpreadsheet.