File: eaf_n_cst_excelproviderservice.sru
Size: 2345
Date: Tue, 22 Jan 2008 23:40:16 +0100
$PBExportHeader$eaf_n_cst_excelproviderservice.sru
forward
global type eaf_n_cst_excelproviderservice from n_cst_contentproviderservice
end type
end forward

global type eaf_n_cst_excelproviderservice from n_cst_contentproviderservice
end type
global eaf_n_cst_excelproviderservice eaf_n_cst_excelproviderservice

forward prototypes
public function long createcontentmain (ref n_cst_datasetattrib anv_datasetattrib, ref s_mimedataset astr_mimedataset)
end prototypes

public function long createcontentmain (ref n_cst_datasetattrib anv_datasetattrib, ref s_mimedataset astr_mimedataset);////////////////////////////////////////////////////////////////
// Description:
//    Main method for the Excel createContent process
// Revisions
//    3.0   - Initial version
// Arguments:  
//    n_cst_datasetattrib  -  REF
//    s_mimerequest        -  REF   
// Returns: 
//     1 - Success
//    -1 - Failure
////////////////////////////////////////////////////////////////
// Copyright © 2000 - 2007 Youngsoft, Inc.  All rights reserved.
// Any distribution of the Youngsoft, Inc. Enterprise Application Framework
// source code in whole or part by other than Youngsoft, Inc. is prohibited.
//////////////////////////////////////////////////////////////// 

string                           METHOD_NAME = "createContentMain( REF n_cst_datasetattrib, REF s_mimedataset )"

string                           ls_value
string                           ls_filename
string                           ls_directory

try
   //Generate the temporary file name
   if generateTempFileName( ls_directory, ls_filename ) = -1 then
      addError( METHOD_NAME, "Excel generation failed.  Could not generate temporary filename." )
      return -1
   end if
   
   //Print the content
   if anv_datasetattrib.ids_working.saveAs( ls_directory + ls_filename, Excel!, true ) = -1 then
      addError( METHOD_NAME, "Excel generation failed.  SaveAs failed." )
      return -1
   end if
   
   //Set the file contents of the Excel file on the dataset structure
   if readFile( ls_directory + ls_filename, astr_mimedataset.data.binary, true ) = -1 then
      addError( METHOD_NAME, "Excel generation failed.  Could not read the file." )
      return -1
   end if
finally

end try

return 1

end function

on eaf_n_cst_excelproviderservice.create
call super::create
end on

on eaf_n_cst_excelproviderservice.destroy
call super::destroy
end on