Hi Rainbow Lovers,
Everyone needs a little help along the way. Hope you enjoy my very first humble article on Rainbow. I've noticed that there are not many sources of examples yet on Rainbow.
Rainbow Module Install Instructions for OneFileModule: ExcelReader
The OneFileModule is a Rainbow standard Module which supports passing parameters in the form of key/value pairs as a form of input to the module.
Parm1=abc;parm2=999;
Your can create new Modules which use this OneFileModule by inheriting from it. Thus the Rainbow Install provides some examples on how to do this.
How to install the OneFileModule Examples: ExcelReader
C:\Inetpub\wwwroot\Rainbow\DesktopModules\OneFileModule\CSharp Examples\ExcelReader
Summary:
0. Generate a new GUID
1. Install UserControl .ascx file
2. Run Sql Patch to define the OneFileModule ExcelReader in Rainbow Db
3. Add a new page: add the Excel Reader Module on the Page
4. Edit the Module Settings for the module as key / value pairs
Details:
1. Copy the one file: User Control to Display the Excel File in a datagrid
Copy ExcelReader.ascx to /chaz/DesktopModules/ExcelReader.ascx
2. Run this modified DBPatch.Sql to install the ExcelReader Module into your Rainbow Database.
SET @GeneralModDefID = '{1E03D793-5A01-4f35-811D-5D23EF66618D}'
-- ***** generate a new GUID and copy in excelreader.ascx *****
SET @FriendlyName = 'ExcelReader (OneFileModule)' -- You enter the module UI name here
-- Warning this is the relative folder where you install/copy the User Control on your Rainbow Site:
SET @DesktopSrc = 'DesktopModules/ExcelReader.ascx' -- You enter actual filename here
SET @MobileSrc = ''
SET @AssemblyName = 'Rainbow.DLL' -- The Module Code is embedded in the Rainbow Assembly
SET @ClassName = 'Rainbow.DesktopModules.OneFileModule' -- Specify the base module which ExcelReader uses
SET @Admin = 0
SET @Searchable = 0
IF NOT EXISTS (SELECT DesktopSrc FROM rb_GeneralModuleDefinitions WHERE DesktopSrc = @DesktopSrc)
BEGIN
-- Installs module
EXEC [rb_AddGeneralModuleDefinitions] @GeneralModDefID, @FriendlyName, @DesktopSrc, @MobileSrc, @AssemblyName, @ClassName, @Admin, @Searchable
-- Install it for default portal
EXEC [rb_UpdateModuleDefinitions] @GeneralModDefID, 0, 1
END
GO
3. Create a new TabPage and add the ExcelReader Module to the Page
NOTE: ExcelReader module should show in the Module DropDownList
4. Configure the Module to display a specific file specified in the Module Settings
key/value pairs
Specify the excelfile
Specify the excelfile Range
Settings String = ExcelFile=exceltest.xls;RangeName=a1:e5
Where exceltest.xls is located at: /chaz/DesktopModules/ExcelTest.xls
ExcelReader.ascx - modified version
NOTE: These files have been changed slightly in the article below.
The main change was this line:
1. You should change the GUID in the Sql Patch file and in the .ascx file.
2. String sExcelFile = Server.MapPath("/chaz/DeskTopModules/" + pt.Value);
3. I also added exception logic:
catch (Exception ee)
{
Response.Write ("
Exception caught here" + ee.ToString ());
Response.Write ("
StackTrace:
" + ee.StackTrace.ToString ());
}
Would you believe ... GetSmartPaul
GetSmartPaul@gmail.com
September 12, 2004