WriteXLRange3





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 7 range objects).

Returns a string mode of success of failure.

This function takes Excel ranges along with Tag Names.

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 ReadXLRange3() function.

The ReadXLRange3() function simply uses the tag name to locate the range you wish to extract.

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.WriteXLRange3




High level graphic of WriteXLRange3() 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. TagName1 parameter

    Name to be assigned to Range1.
  4. Range1 parameter

    Range to write.
  5. TagName2 parameter

    Name to be assigned to Range2.
  6. Range2 parameter

    Range to write.
  7. TagName3 parameter

    Name to be assigned to Range3.
  8. Range3 parameter

    Range to write.
  9. TagName4 parameter

    Name to be assigned to Range4.
  10. Range4 parameter

    Range to write.
  11. TagName5 parameter

    Name to be assigned to Range5.
  12. Range5 parameter

    Range to write.
  13. TagName6 parameter

    Name to be assigned to Range6.
  14. Range6 parameter

    Range to write.
  15. TagName7 parameter

    Name to be assigned to Range7.
  16. Range7 parameter

    Range to write.


Extended information

Function Syntax

VB Syntax


String CTQueryDB.WriteXLRange3( _
String FileName, _
String Path, _
String TagName1, _
Variant Range1, _
String TagName2, _
Variant Range2, _
String TagName3, _
Variant Range3, _
String TagName4, _
Variant Range4, _
String TagName5, _
Variant Range5, _
String TagName6, _
Variant Range6, _
String TagName7, _
Variant Range7)


Excel Spreadsheet Syntax


=CT.XML.WriteXLRange3(
Excel String Cell FileName,
Excel String Cell Path,
Excel String Cell TagName1,
XLRange Range1,
Excel String Cell TagName2,
XLRange Range2,
Excel String Cell TagName3,
XLRange Range3,
Excel String Cell TagName4,
XLRange Range4,
Excel String Cell TagName5,
XLRange Range5,
Excel String Cell TagName6,
XLRange Range6,
Excel String Cell TagName7,
XLRange Range7)


C++ Syntax


static std::string WriteXLRange3(
std::string FileName,
std::string Path,
std::string TagName1,
CTRangeDataCPP Range1,
std::string TagName2,
CTRangeDataCPP Range2,
std::string TagName3,
CTRangeDataCPP Range3,
std::string TagName4,
CTRangeDataCPP Range4,
std::string TagName5,
CTRangeDataCPP Range5,
std::string TagName6,
CTRangeDataCPP Range6,
std::string TagName7,
CTRangeDataCPP Range7);


DotNET Syntax


System.String CTQueryDBSA.WriteXLRange3(
System.String FileName,
System.String Path,
System.String TagName1,
CTRangeData Range1,
System.String TagName2,
CTRangeData Range2,
System.String TagName3,
CTRangeData Range3,
System.String TagName4,
CTRangeData Range4,
System.String TagName5,
CTRangeData Range5,
System.String TagName6,
CTRangeData Range6,
System.String TagName7,
CTRangeData Range7);

Parameter data types

ArgNameArgTypeIsKey
FileNameStringFALSE
PathStringFALSE
TagName1StringFALSE
Range1RangeFALSE
TagName2StringFALSE
Range2RangeFALSE
TagName3StringFALSE
Range3RangeFALSE
TagName4StringFALSE
Range4RangeFALSE
TagName5StringFALSE
Range5RangeFALSE
TagName6StringFALSE
Range6RangeFALSE
TagName7StringFALSE
Range7RangeFALSE


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
FileNameFALSEMyXLData3
PathTRUEC:\
TagName1FALSECostData
Range1FALSEWriteXLRange3_Range1_Range (creates a range object)
TagName2TRUEYieldCurveData
Range2TRUEWriteXLRange3_Range2_Range (creates a range object)
TagName3TRUE
Range3TRUEWriteXLRange3_Range3
TagName4TRUE
Range4TRUEWriteXLRange3_Range4
TagName5TRUE
Range5TRUEWriteXLRange3_Range5
TagName6TRUE
Range6TRUEWriteXLRange3_Range6
TagName7TRUE
Range7TRUEWriteXLRange3_Range7


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 WriteXLRange3_Range1 = new CTQL.CTRangeData();

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

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

// Parse the string into the Range object.
WriteXLRange3_Range1.RangeFromStr( WriteXLRange3_Range1_builder.ToString() );


Example range for parameter : Range2

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

1Y5.00
2Y5.01
3Y5.02
4Y5.03
5Y5.04
7Y5.05
10Y5.06

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



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

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

WriteXLRange3_Range2_builder.Append("{");
WriteXLRange3_Range2_builder.Append("'1Y'	 | 5.00 ;");
WriteXLRange3_Range2_builder.Append("'2Y'	 | 5.01 ;");
WriteXLRange3_Range2_builder.Append("'3Y'	 | 5.02 ;");
WriteXLRange3_Range2_builder.Append("'4Y'	 | 5.03 ;");
WriteXLRange3_Range2_builder.Append("'5Y'	 | 5.04 ;");
WriteXLRange3_Range2_builder.Append("'7Y'	 | 5.05 ;");
WriteXLRange3_Range2_builder.Append("'10Y'	 | 5.06");
WriteXLRange3_Range2_builder.Append("}");

// Parse the string into the Range object.
WriteXLRange3_Range2.RangeFromStr( WriteXLRange3_Range2_builder.ToString() );


Example range for parameter : Range3

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


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





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 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 WriteXLRange3() 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 WriteXLRange3() function call


OK

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