WriteXLRange2





http://www.QuantTools.com
CapeTools QueryDB function list

Welcome | Documentation format | QuantTools Groups | QuantTools Categories | Licence

Key TAGs | Excel Index | API Index



Writes a series of range objects to a single XML file (Up to 15 range objects).

Returns a string mode of success of failure.

This function is useful, for example from an Excel environment, if you wish to store several range object within ONE xml file independently from a spreadsheet.

XML files can be saved to a central location where other users can also read these ranges back in via the ReadXLRange2() function.

The ReadXLRange2() function simply uses the an index number (1-based) to locate the range you wish to extract.

The index number used depends on the order in which range objects were passed to this WriteXLRange2() function.

The first range passed in takes on index number 1, the second range, index number 2 etc... You must pass in a range object for the first parameter, but all other parameters are optional (or null objects if using the API functions).

You can also pass in range objects just for parameter 1 and 7 only, thus the indexes used during the reading of these ranges will be 1 and 7 respectively within the ReadXLRange2() function.

This function is essentially an extension of the WriteXLRange() function which deals with only a single range object.



Note: Within Excel, the function is named - CT.XML.WriteXLRange2




High level graphic of WriteXLRange2() function with parameters. Blue square node is the actual function with the parameters ordered.



Parameter Description


  1. FileName parameter

    Name of the file to write to (can include path).
  2. Path parameter

    Optional directory path. Will be pre-pended to the FileName parameter.
  3. Range1 parameter

    Range to write.
  4. Range2 parameter

    Range to write.
  5. Range3 parameter

    Range to write.
  6. Range4 parameter

    Range to write.
  7. Range5 parameter

    Range to write.
  8. Range6 parameter

    Range to write.
  9. Range7 parameter

    Range to write.
  10. Range8 parameter

    Range to write.
  11. Range9 parameter

    Range to write.
  12. Range10 parameter

    Range to write.
  13. Range11 parameter

    Range to write.
  14. Range12 parameter

    Range to write.
  15. Range13 parameter

    Range to write.
  16. Range14 parameter

    Range to write.
  17. Range15 parameter

    Range to write.


Extended information

Function Syntax

VB Syntax


String CTQueryDB.WriteXLRange2( _
String FileName, _
String Path, _
Variant Range1, _
Variant Range2, _
Variant Range3, _
Variant Range4, _
Variant Range5, _
Variant Range6, _
Variant Range7, _
Variant Range8, _
Variant Range9, _
Variant Range10, _
Variant Range11, _
Variant Range12, _
Variant Range13, _
Variant Range14, _
Variant Range15)


Excel Spreadsheet Syntax


=CT.XML.WriteXLRange2(
Excel String Cell FileName,
Excel String Cell Path,
XLRange Range1,
XLRange Range2,
XLRange Range3,
XLRange Range4,
XLRange Range5,
XLRange Range6,
XLRange Range7,
XLRange Range8,
XLRange Range9,
XLRange Range10,
XLRange Range11,
XLRange Range12,
XLRange Range13,
XLRange Range14,
XLRange Range15)


C++ Syntax


static std::string WriteXLRange2(
std::string FileName,
std::string Path,
CTRangeDataCPP Range1,
CTRangeDataCPP Range2,
CTRangeDataCPP Range3,
CTRangeDataCPP Range4,
CTRangeDataCPP Range5,
CTRangeDataCPP Range6,
CTRangeDataCPP Range7,
CTRangeDataCPP Range8,
CTRangeDataCPP Range9,
CTRangeDataCPP Range10,
CTRangeDataCPP Range11,
CTRangeDataCPP Range12,
CTRangeDataCPP Range13,
CTRangeDataCPP Range14,
CTRangeDataCPP Range15);


DotNET Syntax


System.String CTQueryDBSA.WriteXLRange2(
System.String FileName,
System.String Path,
CTRangeData Range1,
CTRangeData Range2,
CTRangeData Range3,
CTRangeData Range4,
CTRangeData Range5,
CTRangeData Range6,
CTRangeData Range7,
CTRangeData Range8,
CTRangeData Range9,
CTRangeData Range10,
CTRangeData Range11,
CTRangeData Range12,
CTRangeData Range13,
CTRangeData Range14,
CTRangeData Range15);

Parameter data types

ArgNameArgTypeIsKey
FileNameStringFALSE
PathStringFALSE
Range1RangeFALSE
Range2RangeFALSE
Range3RangeFALSE
Range4RangeFALSE
Range5RangeFALSE
Range6RangeFALSE
Range7RangeFALSE
Range8RangeFALSE
Range9RangeFALSE
Range10RangeFALSE
Range11RangeFALSE
Range12RangeFALSE
Range13RangeFALSE
Range14RangeFALSE
Range15RangeFALSE


Example Inputs

The first column represents the name of the parameters. The second column specifies whether the parameters are optional or not. Finally the last column provides some sample input data.
Function call input string-keys are always in the format : "NAME.EXTTAG.TICKER" The "EXTTAG.TICKER" part is determined from the output of other, capetools, object creation functions.


ArgNameIsOptional (Excel only)Example
FileNameFALSEMyXLData2
PathTRUEC:\
Range1FALSEWriteXLRange2_Range1_Range (creates a range object)
Range2TRUEWriteXLRange2_Range2_Range (creates a range object)
Range3TRUEWriteXLRange2_Range3_Range (creates a range object)
Range4TRUEWriteXLRange2_Range4
Range5TRUEWriteXLRange2_Range5
Range6TRUEWriteXLRange2_Range6
Range7TRUEWriteXLRange2_Range7
Range8TRUEWriteXLRange2_Range8
Range9TRUEWriteXLRange2_Range9
Range10TRUEWriteXLRange2_Range10
Range11TRUEWriteXLRange2_Range11
Range12TRUEWriteXLRange2_Range12
Range13TRUEWriteXLRange2_Range13
Range14TRUEWriteXLRange2_Range14
Range15TRUEWriteXLRange2_Range15


Example range for parameter : Range1

Within Excel, a range such as this can be passed directly into the Range1 parameter.

17
28
39
410
511
612

Example C# API usage for setting the range data for parameter : Range1



CTQL.CTRangeData WriteXLRange2_Range1 = new CTQL.CTRangeData();

System.Text.StringBuilder WriteXLRange2_Range1_builder =
new System.Text.StringBuilder(100);

WriteXLRange2_Range1_builder.Append("{");
WriteXLRange2_Range1_builder.Append("1	 | 7 ;");
WriteXLRange2_Range1_builder.Append("2	 | 8 ;");
WriteXLRange2_Range1_builder.Append("3	 | 9 ;");
WriteXLRange2_Range1_builder.Append("4	 | 10 ;");
WriteXLRange2_Range1_builder.Append("5	 | 11 ;");
WriteXLRange2_Range1_builder.Append("6	 | 12");
WriteXLRange2_Range1_builder.Append("}");

// Parse the string into the Range object.
WriteXLRange2_Range1.RangeFromStr( WriteXLRange2_Range1_builder.ToString() );


Example range for parameter : Range2

Within Excel, a range such as this can be passed directly into the Range2 parameter.

17
AHi mum
39
410
B11
63.56

Example C# API usage for setting the range data for parameter : Range2



CTQL.CTRangeData WriteXLRange2_Range2 = new CTQL.CTRangeData();

System.Text.StringBuilder WriteXLRange2_Range2_builder =
new System.Text.StringBuilder(100);

WriteXLRange2_Range2_builder.Append("{");
WriteXLRange2_Range2_builder.Append("1	 | 7 ;");
WriteXLRange2_Range2_builder.Append("'A'	 | 'Hi mum' ;");
WriteXLRange2_Range2_builder.Append("3	 | 9 ;");
WriteXLRange2_Range2_builder.Append("4	 | 10 ;");
WriteXLRange2_Range2_builder.Append("'B'	 | 11 ;");
WriteXLRange2_Range2_builder.Append("6	 | 3.56");
WriteXLRange2_Range2_builder.Append("}");

// Parse the string into the Range object.
WriteXLRange2_Range2.RangeFromStr( WriteXLRange2_Range2_builder.ToString() );


Example range for parameter : Range3

Within Excel, a range such as this can be passed directly into the Range3 parameter.

17
AHi mum

Example C# API usage for setting the range data for parameter : Range3



CTQL.CTRangeData WriteXLRange2_Range3 = new CTQL.CTRangeData();

System.Text.StringBuilder WriteXLRange2_Range3_builder =
new System.Text.StringBuilder(100);

WriteXLRange2_Range3_builder.Append("{");
WriteXLRange2_Range3_builder.Append("1	 | 7 ;");
WriteXLRange2_Range3_builder.Append("'A'	 | 'Hi mum'");
WriteXLRange2_Range3_builder.Append("}");

// Parse the string into the Range object.
WriteXLRange2_Range3.RangeFromStr( WriteXLRange2_Range3_builder.ToString() );


Example range for parameter : Range4

Within Excel, a range such as this can be passed directly into the Range4 parameter.


Example C# API usage for setting the range data for parameter : Range4





Example range for parameter : Range5

Within Excel, a range such as this can be passed directly into the Range5 parameter.


Example C# API usage for setting the range data for parameter : Range5





Example range for parameter : Range6

Within Excel, a range such as this can be passed directly into the Range6 parameter.


Example C# API usage for setting the range data for parameter : Range6





Example range for parameter : Range7

Within Excel, a range such as this can be passed directly into the Range7 parameter.


Example C# API usage for setting the range data for parameter : Range7





Example range for parameter : Range8

Within Excel, a range such as this can be passed directly into the Range8 parameter.


Example C# API usage for setting the range data for parameter : Range8





Example range for parameter : Range9

Within Excel, a range such as this can be passed directly into the Range9 parameter.


Example C# API usage for setting the range data for parameter : Range9





Example range for parameter : Range10

Within Excel, a range such as this can be passed directly into the Range10 parameter.


Example C# API usage for setting the range data for parameter : Range10





Example range for parameter : Range11

Within Excel, a range such as this can be passed directly into the Range11 parameter.


Example C# API usage for setting the range data for parameter : Range11





Example range for parameter : Range12

Within Excel, a range such as this can be passed directly into the Range12 parameter.


Example C# API usage for setting the range data for parameter : Range12





Example range for parameter : Range13

Within Excel, a range such as this can be passed directly into the Range13 parameter.


Example C# API usage for setting the range data for parameter : Range13





Example range for parameter : Range14

Within Excel, a range such as this can be passed directly into the Range14 parameter.


Example C# API usage for setting the range data for parameter : Range14





Example range for parameter : Range15

Within Excel, a range such as this can be passed directly into the Range15 parameter.


Example C# API usage for setting the range data for parameter : Range15






Example function usage


The C# example below contains all the sub-function calls leading up to this function call. As a result, the example can contain a lot of code.

The VB.NET, J#, C++.NET, Java, Excel VBA, Visual Basic 6 (via COM) and C++ examples below contain function code stubs for the calls leading up to this function call. However, the function call for this function is displayed.
You can easily reproduce the stub functions code from the C# example.


If you are accessing this functrion via the MiniXL libraries, this function is present within the CT.QL.Utils20 MiniXL Excel Addin.

Within our Excel Example Addin Generator, we have used the following QuantTools sub-functions in order to prepare the arguments needed to call the WriteXLRange2() function. If you are executing this function via the MiniXL libraries, the module addin name, (in brackets, to the right of the sub-functions listed below), indicates the MiniXL library in which the sub-function is held. You will need to load this library into your Excel session (along with any other libraries that the sub-function call within the addin requires (ie - CT.QT.Utils20 addin in almost all cases) in order for the example to compute successfully.


The following four examples demostrate calling this function within a Microsoft .NET environment

The following four examples demostrate calling this function within a non .NET environment

The following is a sample output from executing the WriteXLRange2() function call


OK

Copyright (c) 2003-2007 CapeTools - All Rights Reserved.