Advertisement
Guest User

Untitled

a guest
Oct 1st, 2019
589
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 11.42 KB | None | 0 0
  1. <process name="__selection__MS Excel VBO" type="object">
  2.   <subsheet subsheetid="5bd911d6-6eee-4cfb-bb39-693a93c05faa" type="Normal" published="False">
  3.     <name>Write Collection Direct</name>
  4.     <view>
  5.       <camerax>0</camerax>
  6.       <cameray>-63</cameray>
  7.       <zoom version="2">1.25</zoom>
  8.     </view>
  9.   </subsheet>
  10.   <stage stageid="391ffed5-b89e-401b-8105-d35025df96f9" name="Write Collection Direct" type="SubSheetInfo">
  11.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  12.     <narrative>Writes the given collection into the specified sheet.</narrative>
  13.     <displayx>-195</displayx>
  14.     <displayy>-105</displayy>
  15.     <displaywidth>180</displaywidth>
  16.     <displayheight>90</displayheight>
  17.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  18.   </stage>
  19.   <stage stageid="6cf4569a-b7b2-4919-af69-7bb5e9b63a6c" name="Start" type="Start">
  20.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  21.     <loginhibit />
  22.     <narrative></narrative>
  23.     <displayx>45</displayx>
  24.     <displayy>-135</displayy>
  25.     <displaywidth>60</displaywidth>
  26.     <displayheight>30</displayheight>
  27.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  28.     <inputs>
  29.       <input type="number" name="handle" narrative="The integer handle identifying the instance on which the specified collection should be written. The default of zero indicates the currently active instance." stage="handle" />
  30.       <input type="collection" name="Collection" narrative="The collection containing the data which should be written to the worksheet." stage="Collection_GC" />
  31.       <input type="text" name="Workbook Name" narrative="The name of the workbook within which the data should be written. The default empty value indicates the current workbook within the specified instance." stage="workbookname" />
  32.       <input type="text" name="Worksheet Name" narrative="The name of the worksheet on which the given data should be written. The default empty value indicates the current sheet within the specified workbook." stage="worksheetname" />
  33.       <input type="text" name="Cell Reference" narrative="The reference at which the collection should be written." stage="cellref" />
  34.       <input type="flag" name="Include Column Names" narrative="True to indicate that the column names from the collection should be written out as the first row; False to ignore the column names and just write out the data." stage="includecolnames" />
  35.       <input type="number" name="rowlimit" narrative="Batch size, default 5000. Set lower if getting OOM" stage="rowlimit" />
  36.     </inputs>
  37.     <onsuccess>76a94c0c-a0b3-46c2-ba3d-b0e6eb32f51f</onsuccess>
  38.   </stage>
  39.   <stage stageid="79c25ffc-d104-4392-b088-1d73e0240029" name="End" type="End">
  40.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  41.     <loginhibit />
  42.     <narrative></narrative>
  43.     <displayx>45</displayx>
  44.     <displayy>60</displayy>
  45.     <displaywidth>60</displaywidth>
  46.     <displayheight>30</displayheight>
  47.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  48.   </stage>
  49.   <stage stageid="56a00ede-ce25-47b7-8ab1-b4ebe8f2c9ef" name="handle" type="Data">
  50.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  51.     <narrative></narrative>
  52.     <displayx>-255</displayx>
  53.     <displayy>-30</displayy>
  54.     <displaywidth>120</displaywidth>
  55.     <displayheight>30</displayheight>
  56.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  57.     <datatype>number</datatype>
  58.     <initialvalue />
  59.     <private />
  60.     <alwaysinit />
  61.   </stage>
  62.   <stage stageid="a1323bd1-0c53-4078-bb06-8fba4962eed5" name="worksheetname" type="Data">
  63.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  64.     <narrative></narrative>
  65.     <displayx>-255</displayx>
  66.     <displayy>60</displayy>
  67.     <displaywidth>120</displaywidth>
  68.     <displayheight>30</displayheight>
  69.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  70.     <datatype>text</datatype>
  71.     <initialvalue />
  72.     <private />
  73.     <alwaysinit />
  74.   </stage>
  75.   <stage stageid="1175ed17-2984-4ee1-b630-f62fd5d32e7d" name="workbookname" type="Data">
  76.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  77.     <narrative></narrative>
  78.     <displayx>-255</displayx>
  79.     <displayy>15</displayy>
  80.     <displaywidth>120</displaywidth>
  81.     <displayheight>30</displayheight>
  82.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  83.     <datatype>text</datatype>
  84.     <initialvalue />
  85.     <private />
  86.     <alwaysinit />
  87.   </stage>
  88.   <stage stageid="c8f5023a-90d7-422d-987b-3f8a9035eca6" name="includecolnames" type="Data">
  89.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  90.     <narrative></narrative>
  91.     <displayx>-135</displayx>
  92.     <displayy>60</displayy>
  93.     <displaywidth>120</displaywidth>
  94.     <displayheight>30</displayheight>
  95.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  96.     <datatype>flag</datatype>
  97.     <initialvalue />
  98.     <private />
  99.     <alwaysinit />
  100.   </stage>
  101.   <stage stageid="76a94c0c-a0b3-46c2-ba3d-b0e6eb32f51f" name="Activate Worksheet" type="SubSheet">
  102.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  103.     <loginhibit />
  104.     <narrative></narrative>
  105.     <displayx>45</displayx>
  106.     <displayy>-75</displayy>
  107.     <displaywidth>120</displaywidth>
  108.     <displayheight>30</displayheight>
  109.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  110.     <inputs>
  111.       <input type="number" name="handle" narrative="The integer handle identifying the instance on which the worksheet which should be activated resides. The default of zero indicates the currently active instance." expr="[handle]" />
  112.       <input type="text" name="Workbook Name" narrative="The name of the workbook in which the sheet exists - The default empty value indicates the currently active workbook on the specified instance." expr="[workbookname]" />
  113.       <input type="text" name="Worksheet Name" narrative="The name of the sheet which should be activated. The default empty text value indicates that the currently active sheet should be, er, activated, making this a no-op." expr="[worksheetname]" />
  114.       <input type="flag" name="Create If Missing?" narrative="True to create the sheet if it isn't present on the specified workbook; False to not do so." expr="False" />
  115.     </inputs>
  116.     <onsuccess>1e3b602c-be95-4738-afa1-b9495967ed96</onsuccess>
  117.     <processid>733c2840-8162-465a-a8f2-7d023087c369</processid>
  118.   </stage>
  119.   <stage stageid="1e3b602c-be95-4738-afa1-b9495967ed96" name="WriteCollectionEx" type="Code">
  120.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  121.     <loginhibit />
  122.     <narrative></narrative>
  123.     <displayx>45</displayx>
  124.     <displayy>-15</displayy>
  125.     <displaywidth>120</displaywidth>
  126.     <displayheight>30</displayheight>
  127.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  128.     <inputs>
  129.       <input type="number" name="handle" expr="[handle]" />
  130.       <input type="text" name="workbookname" expr="[workbookname]" />
  131.       <input type="text" name="worksheetname" expr="[worksheetname]" />
  132.       <input type="text" name="cellref" expr="[cellref]" />
  133.       <input type="collection" name="collection" expr="[Collection_GC]" />
  134.       <input type="flag" name="includecolnames" expr="[includecolnames]" />
  135.       <input type="number" name="rowlimit" expr="[rowlimit]" />
  136.     </inputs>
  137.     <onsuccess>79c25ffc-d104-4392-b088-1d73e0240029</onsuccess>
  138.     <code><![CDATA[' Get to the cell
  139. Dim xlInstance = GetInstance(handle)
  140. Dim xlWorkSheet As Object = GetWorksheet(handle, workbookname, worksheetname)
  141. Dim dtRowCount As Integer = Collection.Rows.Count
  142. Dim dtColCount As Integer = Collection.Columns.Count
  143. Dim objXlColHeaderData(1, dtColCount) As Object
  144. Dim OffsetRow As Integer = 0
  145.  
  146. If rowlimit < 1 Then rowlimit = 1
  147.  
  148. For i As Integer = 0 To dtColCount - 1
  149.  objXlColHeaderData(0, i) = Collection.Columns(i).ColumnName
  150. Next
  151.  
  152. If includecolnames Then
  153.    xlWorkSheet.Range(cellref).Resize(1, dtColCount).Value = objXlColHeaderData
  154.    objXlColHeaderData = Nothing
  155.    GC.Collect()
  156.    OffsetRow = 1
  157. End If
  158.  
  159. Dim blStart As Integer
  160. Dim blRowCount As Integer
  161. If cellref = "" then cellref = "A1"
  162. For blStart = 0 to dtRowCount -1 step rowlimit
  163.    If blStart+rowlimit > dtRowCount Then
  164.        blRowCount = dtRowCount - blStart
  165.    Else
  166.        blRowCount = rowlimit
  167.    End If
  168.  
  169.    Dim objXlData(blRowCount, dtColCount) As Object
  170.    For iRow As Integer = blStart To blStart + blRowCount - 1
  171.      For iCol As Integer = 0 To dtColCount - 1
  172.            If IsDBNull(Collection.Rows(iRow).Item(iCol)) Then
  173.            objXlData(iRow-blStart, iCol) = ""
  174.          Elseif TypeOf Collection.Rows(iRow).Item(iCol) is String then
  175.          If Left(Collection.Rows(iRow).Item(iCol),1) = "=" then
  176.            objXlData(iRow-blStart, iCol) = "'" & Collection.Rows(iRow).Item(iCol)
  177.          Else
  178.            objXlData(iRow-blStart, iCol) = Collection.Rows(iRow).Item(iCol)
  179.          End if
  180.          Elseif TypeOf Collection.Rows(iRow).Item(iCol) is DataTable then
  181.          Dim sw as StringWriter = new StringWriter()
  182.          Collection.Rows(iRow).Item(iCol).WriteXml(sw)
  183.          objXlData(iRow-blStart, iCol) = sw.ToString()
  184.        Else
  185.            objXlData(iRow-blStart, iCol) = Collection.Rows(iRow).Item(iCol)
  186.                End If
  187.            Next
  188.    Next
  189.  
  190.    xlWorkSheet.Range(cellref).Offset(OffsetRow+blStart,0).Resize(blRowCount, dtColCount).Value = objXlData
  191.  'below SetProperty does the same as above, but uses system Culture, which is inconsistent. I intentionally dont want to do that.
  192.  'SetProperty(xlWorkSheet.Range(cellref).Offset(OffsetRow+blStart,0).Resize(blRowCount, dtColCount), "Value", objXlData)
  193.    objXlData = Nothing
  194.    GC.Collect()
  195. Next
  196.  
  197. xlWorkSheet=Nothing
  198. Collection = Nothing
  199. System.Runtime.GCSettings.LargeObjectHeapCompactionMode = System.Runtime.GCLargeObjectHeapCompactionMode.CompactOnce
  200. GC.Collect() ]]></code>
  201.   </stage>
  202.   <stage stageid="688464a6-a1a5-4fbd-baae-6130ebdcfb20" name="cellref" type="Data">
  203.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  204.     <narrative></narrative>
  205.     <displayx>-135</displayx>
  206.     <displayy>-30</displayy>
  207.     <displaywidth>120</displaywidth>
  208.     <displayheight>30</displayheight>
  209.     <font family="Tahoma" size="10" style="Regular" color="000000" />
  210.     <datatype>text</datatype>
  211.     <initialvalue xml:space="preserve">A1</initialvalue>
  212.     <private />
  213.     <alwaysinit />
  214.   </stage>
  215.   <stage stageid="b474d3dc-f890-4786-a9f7-fa87398e9f55" name="rowlimit" type="Data">
  216.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  217.     <narrative></narrative>
  218.     <displayx>-135</displayx>
  219.     <displayy>15</displayy>
  220.     <displaywidth>120</displaywidth>
  221.     <displayheight>30</displayheight>
  222.     <font family="Segoe UI" size="10" style="Regular" color="000000" />
  223.     <datatype>number</datatype>
  224.     <initialvalue>5000</initialvalue>
  225.     <private />
  226.     <alwaysinit />
  227.   </stage>
  228.   <stage stageid="91bf4f2b-1a70-4f3c-bb8e-97a425487e65" name="Collection_GC" type="Collection">
  229.     <subsheetid>5bd911d6-6eee-4cfb-bb39-693a93c05faa</subsheetid>
  230.     <narrative></narrative>
  231.     <displayx>120</displayx>
  232.     <displayy>-135</displayy>
  233.     <displaywidth>60</displaywidth>
  234.     <displayheight>30</displayheight>
  235.     <font family="Segoe UI" size="10" style="Regular" color="000000" />
  236.     <datatype>collection</datatype>
  237.     <private />
  238.     <alwaysinit />
  239.   </stage>
  240. </process>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement