commit 4f6f7e4b43583853a129ea700af71696fd7c70da
parent d86877f11480f038143b9704d0280aeb94e739e4
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 17 Oct 2026 10:25:58 +0530
parent d86877f11480f038143b9704d0280aeb94e739e4
Author: Bharatvaj Hemanth <bharatvaj@yahoo.com>
Date: Sat, 17 Oct 2026 10:25:58 +0530
Keep Basic sources in Basic/Standard and pack workbook
25 files changed, 3429 insertions(+), 3124 deletions(-)
A
|
1171
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
|
1241
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
A
|
822
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
D
|
1171
-------------------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes @@ -1 +1,2 @@ *.ods binary +*.png binary
diff --git a/.gitignore b/.gitignore @@ -1 +1,5 @@ tags +/SondageAutomation.ods +*.ods.bak +__pycache__/ +.~lock.*#
diff --git a/Basic/Standard/CylinderAutomation.bas b/Basic/Standard/CylinderAutomation.bas @@ -0,0 +1,1171 @@ +'Copyright 2023-2025 Bharatvaj Hemanth <bharatvaj@yahoo.com> + +'Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +'1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + +'2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following +'disclaimer in the documentation and/or other materials provided with the distribution. + +'3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote +'products derived from this software without specific prior written permission. + +'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND +'ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +'WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +'DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +'FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +'DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +'SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +'AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +'(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +'SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +'Option VBASupport 1 +Option Explicit + +Type SondageSettings + oFieldAliasesRange as Variant +End Type + +Type SondageContext + oDoc as Variant + oSheet as Variant + oRange as Variant + headerRow& + startColumn& + startRow& + endColumn& + endRow& +End Type + +Private GlobalSondageSettings as New SondageSettings + +' Options read from sheet + +Private orgCode As String +Private exportPrefix As String +' Allowed values, +' EKYC, PENDING, INSPECTION, SBC, POPULATE +'The number of columns that are copied and the column size will be affected +Private reportType As String +Private inputType As String +'Holds filter information such as ONLINE +Private reportFilter As String +' The days below 'thorgCodee maximum date in report' to show as bad +Private priorityThreshold As Integer +Private highlightColor As Long +Private priorityColor As Long +Private isHeadless As Boolean +Private isDBRequired as Boolean +' True if you want to create sheets with Area specific data +Private enableGroupReports As Boolean +Private organizeInputsFolder as String +Private removeInputFileAfterSuccess as Boolean +Private gvtSoftwareFolder$ +Private debugInputFile$ +Private customerDBFile$ +Private shouldSyncWithGVT as Boolean +Private ErrorLocal$ +Private pendingRemarksValidateList$ +Private ekycRemarksList$ + +Private stateName As String +Private cityName As String + +Global Const highlightBasedOn = "Payment Option" ' A yellow background is drawn that matches this column and 'highlightSearchString' +Global Const highlightSearchString = "Online" ' Does partial match +Global Const highlightRemoveColumn = True ' True if you want remove the column once the highlight is done +Global Const shouldRunSubtotals = True +Global Const shouldExportPDF = True ' If True this will export all the created sheets with Area specific data individually TODO change name to easily understand +Global Const shouldExportSummaryEditable = True ' If True this will export summary editable +'Private shouldExportSummaryPDF as Boolean' If True the first page will be exported as PDF +Global Const shouldCreateDataPivot = False +Global Const CURRENCY_UNIT = "" + +Global Const CSV_FILTER_NAME = "Text - txt - csv (StarCalc)" + +' Refer https://help.libreoffice.org/latest/en-US/text/shared/guide/csv_params.html +Global Const PENDING_CSV_FILTER_OPTIONS = "44,34,76,1,5/9/6/4/7/1/8/9/9/9/10/9" +' Values are loaded from the document +' Move all these to SondageContext? Which contain sheet, {start,end}{Column,Row} and others common things +Private tillDate As Date +Private tillDateStr As String +Private fromDate As Date +Private fromDateStr As String +Private sheetNameSuffix As String +Private exportDestDir As String + +Sub CleanupProductCode(oSheet as Object, endColumn as Long, endRow as Long) + MsgBox "Not implemented: productNames" +End Sub + +Sub IterateTableAndAct() + ' Call it Sub-table in Sondage + ' Segregate Sondage as sondage-basic, sondage-db, etc? + Dim oDoc, oSheet, oCell + Dim iRow&, startColumn% + Dim oCursor As Object + Dim oTableRange As Object + Dim nLastRow As Long + Dim nRow As Long + Dim tableCount As Integer + + oDoc = ReturnComponentIfOpen("C:\Users\bhara\Downloads\ViewTransactionDetail.csv") + If IsNull(oDoc) Then + Print "Error opening Transaction Details" + Exit Sub + End If + oSheet = oDoc.getSheets().getByIndex(0) + + ' 1. Find the final used row on the entire sheet to know when to stop looping + oCursor = oSheet.createCursor() + oCursor.gotoEndOfUsedArea(False) + nLastRow = oCursor.RangeAddress.EndRow + + tableCount = 0 + nRow = 0 + + ' 2. Loop down Column A to find individual tables + Do While nRow <= nLastRow + oCell = oSheet.getCellByPosition(0, nRow) + + If oCell.Type <> com.sun.star.table.CellContentType.EMPTY Then + tableCount = tableCount + 1 + oCursor = oSheet.createCursorByRange(oCell) + oCursor.collapseToCurrentRegion() + oTableRange = oCursor.RangeAddress + + 'MsgBox "Found Table " & tableCount & " at Range: " & oTableRange.StartRow + + Dim oCurrentCell, sCurrentCell + oCurrentCell = oSheet.getCellByPosition(oTableRange.startColumn, oTableRange.startRow) + sCurrentCell = oCurrentCell.getString() + If InStr(sCurrentCell, "ConsumerNumber") Then + Act1(oSheet, oTableRange) + End If + + nRow = oCursor.RangeAddress.EndRow + 1 + Else + ' Move to the next row if this one is empty + nRow = nRow + 1 + End If + Loop + + MsgBox "Finished! Total tables found: " & tableCount +End Sub + +Function SondageContextSetRange(ByRef ctx as SondageContext, oRangeAddr, Optional hasHeader as Boolean) + If IsMissing(hasHeader) Then hasHeader = True + ctx.headerRow = oRangeAddr.StartRow + ctx.startColumn = oRangeAddr.startColumn + ctx.startRow = IIf(hasHeader, oRangeAddr.StartRow + 1, oRangeAddr.StartRow) + ctx.endColumn = oRangeAddr.endColumn + ctx.endRow = oRangeAddr.endRow +End Function + +Function Act1(oSheet, oRangeAddr) + Dim ctx as SondageContext + Dim iRow& + Dim iMainColumn% + ctx.oSheet = oSheet + SondageContextSetRange(ctx, oRangeAddr) + ' TODO Make this more flexible with regex, so this can + ' be set easily in the sheet + iMainColumn = GetHeaderPosition(ctx, "ConsumerNumber", True) + + If iMainColumn = -1 Then Exit Function + For iRow = ctx.startRow To ctx.endRow + Print ctx.oSheet.getCellByPosition(iMainColumn, iRow).getString() + Next iRow +End Function + +Function CreatePivotForRefill(ByRef ctx as SondageContext, ByRef sonConf as SondageConfiguration, oDestSheet) + Dim oTables, oTDescriptor, oFields, oField, iField% + Dim oCellAddress as new com.sun.star.table.CellAddress + + oCellAddress.Sheet = oDestSheet + oCellAddress.Column = 0 + oCellAddress.Row = 0 + + oTables = ctx.oSheet.getDataPilotTables() + oTDescriptor = oTables.createDataPilotDescriptor() + oTDescriptor.setSourceRange(ctx.oRange.getRangeAddress()) + + oFields = oTDescriptor.getDataPilotFields() + + iField = GetHeaderPosition("Operator Name") + oField = oFields.getByIndex(iField) + oField.Orientation = com.sun.star.sheet.DataPilotFieldOrientation.ROW + + iField = GetHeaderPosition("Type") + oField = oFields.getByIndex(iField) + oField.Orientation = com.sun.star.sheet.DataPilotFieldOrientation.COLUMN + + iField = GetHeaderPosition("Cylinder Qty") + oField = oFields.getByIndex(iField) + oField.Orientation = com.sun.star.sheet.DataPilotFieldOrientation.DATA + oField.Function = com.sun.star.sheet.GeneralFunction.SUM + + oTables.insertNewByName("REFILLDataPilot", oCellAddress, OTDescriptor) +End Function + +Function ReadSettings() as Boolean + Dim oDoc + Dim oSheet + Dim rangeAddress + Dim oRange + ReadSettings = False + + oSheet = ThisComponent.Sheets.getByName("Settings") + rangeAddress = UsedRangeCursor(oSheet).RangeAddress + oRange = oSheet.getCellRangeByPosition(0, 0, rangeAddress.EndColumn, rangeAddress.EndRow) + + isHeadless = True + ' Organization Details + orgCode = GetValueForKey(oRange, "OrgCode").String + stateName = GetValueForKey(oRange, "StateName").String + cityName = GetValueForKey(oRange, "CityName").String + highlightColor = GetValueForKey(oRange, "HighlightColor").CellBackColor + reportType = GetValueForKey(oRange, "ReportType").String + reportFilter = GetValueForKey(oRange, "ReportFilter").String + exportPrefix = GetValueForKey(oRange, "ExportFolder").String + priorityThreshold = CInt(GetValueForKey(oRange, "PriorityThreshold").String) + priorityColor = GetValueForKey(oRange, "PriorityColor").CellBackColor + enableGroupReports = CBool(GetValueForKey(oRange, "EnableGroupReports").String) + organizeInputsFolder = GetValueForKey(oRange, "OrganizeInputsFolder").String + removeInputFileAfterSuccess = CBool(GetValueForKey(oRange, "RemoveInputFileAfterSuccess").String) + gvtSoftwareFolder = GetValueForKey(oRange, "GVTSoftwareFolder").String + debugInputFile = GetValueForKey(oRange, "DebugInputFile").String + customerDBFile = GetValueForKey(oRange, "CustomerDBFile").String + shouldSyncWithGVT = GetValueForKey(oRange, "ShouldSyncWithGVT").String + pendingRemarksValidateList = GetValueForKey(oRange, "PendingRemarksValidateList").String + ekycRemarksList = GetValueForKey(oRange, "EkycRemarksList").String + ' Skip check if the path is not given + If shouldSyncWithGVT Then + If Not FileExists(gvtSoftwareFolder) Then + MsgBox "Please enter correct one and rerun the macro", 16, "Given GVT Advance Path does not exist" + Exit Function + End If + End If + + 'If IsNull(oCell) Then + ' MsgBox "Setting not found, throw error" + ' Exit Sub + 'End If + ReadSettings = True +End Function + +Function CreateValidationList(ctx as SondageContext, columnName$, sValidationList) + Dim oValidation, oRange, oCell + Dim aItems, sFirstItem$,finalFormula$ + oRange = GetColumnRange(ctx, columnName) + + Dim listDelim: listDelim = CHR(10) + + oValidation = oRange.Validation + oValidation.Type = com.sun.star.sheet.ValidationType.LIST + aItems = Split(sValidationList, listDelim) + + If LBound(aItems) <> -1 Then + sFirstItem = aItems(LBound(aItems)) + Else + sFirstItem = sValidationList + End If + + oCell = oRange.getCellByPosition(0, 0) + oCell.setString(sFirstItem) + + oRange.fillSeries(com.sun.star.sheet.FillDirection.TO_BOTTOM, com.sun.star.sheet.FillMode.SIMPLE, 0, 0, ctx.endRow) + + finalFormula = """" & Join(Split(sValidationList, listDelim), """;""") & """" + oValidation.setFormula1(finalFormula) + oRange.Validation = oValidation +End Function + +Function ValidateDoc(oDoc as Object, docType$) as String + Dim _err$ : _err = "" + if IsEmpty(oDoc)Then + _err = "Failed to get Document for " & sInputFile + ElseIf Not oDoc.supportsService(docType) Then + _err = sInputFile & " is not a valid Spreadsheet Document" + ElseIf oDoc.CurrentController.ViewControllerName = "PrintPreview" Then + _err = "Cannot run this macro in 'Print Preview', please close it and try again" + End If + ValidateDoc = _err +End Function + +Function AssertColumn(ctx as SondageContext, sCol$) as Boolean + Dim iCol% + AssertColumn = True + iCol = GetHeaderPosition(ctx, sCol) + If iCol = -1 Then + ErrorLocal$ = "Cannot proceed, " & sCol & " column is " & iCol + AssertColumn = False + End If +End Function + +Function SondageAppendColumn(ByRef ctx as SondageCtx, sColumnName$) + Dim oCell + Dim oRange + ctx.endColumn = ctx.endColumn + 1 + 'ctx.oSheet.getColumns().insertByIndex(ctx.endColumn, 1) + oCell = ctx.oSheet.getCellByPosition(ctx.endColumn, 0) + oCell.setString(sColumnName) + oRange = GetColumnRange(ctx, sColumnName) + oCell.CellStyle = "Heading 1" +End Function + +Function GetColumnSettings(sheetName$) as Boolean + Dim oDoc, oSheet + GetColumnSettings = False + oDoc = ThisComponent + oSheet = oDoc.getSheets().getByName(sheetName) + If IsNull(oSheet) Then Exit Function +End Function + +Function SondageGetContext(oSheet as Variant) as SondageContext + Dim ctx as New SondageContext + ctx.oSheet = oSheet + ctx.oDoc = oSheet.DrawPage.Forms.Parent + ctx.oRange = UsedRangeCursor(oSheet) + ctx.headerRow = 0 + ctx.startColumn = 0 + ctx.startRow = 1 + ctx.endRow = ctx.oRange.RangeAddress.EndRow + ctx.endColumn = ctx.oRange.RangeAddress.EndColumn + SondageGetContext = ctx +End Function + +Function SondageJoinVertical(ctx as SondageContext, sIdColumn$) + Dim i&: i = 1 + Dim iIdColumn%: iIdColumn = GetHeaderPosition(ctx, sIdColumn) + ' TODO Add mismatching content as array, rather than discarding them entirely + For i = ctx.startRow To ctx.endRow + With ctx.oSheet + If .getCellByPosition(iIdColumn, i).String = .getCellByPosition(iIdColumn, i + 1).String Then + .getRows().removeByIndex(i + 1, 1) + ctx.endRow = ctx.endRow - 1 + End If + End With + Next +End Function + +Function RemoveRows(ByRef ctx as SondageContext, rowsToRemove&) + If rowsToRemove <> 0 Then + ctx.oSheet.getRows().removeByIndex(0, rowsToRemove + 1) + ' FIXME Check this calculation again, this could be reason, West Mambalam is + ' not appearing on the list sometimes + ctx.endRow = ctx.endRow - (rowsToRemove + 1) + End If +End Function + +Function SondageConditionalHorizontalCopy(ctx as SondageContext, sDstColumn$, sSrcColumn$) + iSrcColumn = GetHeaderPosition(ctx, sSrcColumn) + iDstColumn = GetHeaderPosition(ctx, sDstColumn) + + Dim i&: i = 1 + ' Remove duplicates, Move value from 'Phone' if "Mobile' has no value + For i = ctx.startRow To ctx.endRow + With ctx.oSheet + If .getCellByPosition(iDstColumn, i).Value = 0 Then + .getCellByPosition(iDstColumn, i).Value = .getCellByPosition(iSrcColumn, i).Value + End If + End With + Next i +End Function + +Function SondageInit(oDoc) + Dim oFieldAliasesSheet as Variant + oFieldAliasesSheet = oDoc.getSheets().getByName("FieldAliases") + + GlobalSondageSettings.oFieldAliasesRange = UsedRangeCursor(oFieldAliasesSheet) +End Function + +Function SondageGetPropVal(aContainer, sProp$, Optional sDefaultValue) as String + Dim oParent + On Error Goto ErrorHandler + For Each oParent In aContainer + If oParent.Name = sProp Then + SondageGetPropVal = oParent.Value + Exit Function + End If + Next oParent + ErrorHandler: + If Not IsMissing(sDefaultValue) then SondageGetPropVal = sDefaultValue +End Function + +Function SondageReflectionQuickAccess(aContainer, sProp$, oVal, Optional callByNameArg%) as Variant + Dim oParent + If IsMissing(callByNameArg) Then callByNameArg = 2 ' 2 = Get operation + On Error Goto ErrorHandler + For Each oParent In aContainer + Dim propertyValue + propertyValue = CallByName(oParent, sProp, callByNameArg) + If propertyValue = oVal Then + SondageReflectionQuickAccess = oParent + Exit Function + End If + Next oParent + ErrorHandler: +End Function + +Function GetHeaderIndex(aHeader, sProperty$) as Long + Dim i% + GetHeaderIndex = -1 + For i = LBound(aHeader) To UBound(aHeader) + If aHeader(i) = sProperty Then + GetHeaderIndex = i + Exit Function + End If + Next i +End Function + +Function SondageTransformSheet(ctx, sonConf, reportType, sWidthColumn$) + Dim i%, iWidthColumn%, sWidth$ + Dim sField$ + Dim aReports, oReport + + aReports = sonConf.Reports + oReport = SondageReflectionQuickAccess(aReports, "Title", reportType) + + ' TODO Throw error + If IsEmpty(sonConf) Then Exit Function + + iWidthColumn = GetHeaderIndex(sonConf.Headers, sWidthColumn) + + Dim aColumns2D(UBound(oReport.Fields), 1) + For i = 0 To UBound(oReport.Fields) + sField = oReport.Fields(i).Field + aColumns2D(i, 0) = oReport.Fields(i).Field + sWidth = oReport.Fields(i).Values(iWidthColumn) + If sWidth <> "" Then + aColumns2D(i, 1) = CLng(sWidth) + End If + Next i + SondageRestructureColumns(ctx, aColumns2D) +End Function + +Sub _SondageTransformSheet(ctx, reportType$) + Dim oDoc + 'TODO This should be set through GroupHeader logic + oDoc = ctx.oDoc + + If reportType = "PENDING" Then + ApplyTheme(oDoc, "millennium.ots") + RemoveColumnsExcept(ctx, Array( _ + "Area", _ + "Address", _ + "ID", _ + "Name", _ + "Mobile", _ + "Book", _ + "Payment Option", _ + "Code" _ + )) + + SetWidths(ctx, Array( _ + Array("Area", 0), _ + Array("ID", 0), _ + Array("Code", 1000), _ + Array("Name", 7000), _ + Array("Mobile", 0), _ + Array("Book", 0) _ + )) + ElseIf reportType = "INSPECTION" Then + ApplyTheme(oDoc, "green_grapes.ots") + RemoveColumnsExcept(ctx, Array( _ + "Area", _ + "ID", _ + "Name", _ + "Address", _ + "Mobile" _ + )) + ElseIf reportType = "TUBE" Then + ApplyTheme(oDoc, "pumpkin.ots") + endColumn = RemoveColumnsExcept(ctx, Array( _ + "Area", _ + "ID", _ + "Name", _ + "Address", _ + "Mobile" _ + )) + ElseIf reportType = "REFILL" Then + ApplyTheme(oDoc, "pumpkin.ots") + RemoveColumnsExcept(ctx, Array( _ + "ID", _ + "Name", _ + "Code", _ + "Operator Name" _ + )) + '"Block Reason" _ + SetWidths(ctx, Array( _ + Array("ID", 0), _ + Array("Name", 3000), _ + Array("Code", 2000), _ + Array("Operator Name", 4000) _ + )) + ElseIf reportType = "DORMANT" Then + ApplyTheme(oDoc, "pumpkin.ots") + RemoveColumnsExcept(ctx, Array( _ + "Area", _ + "ID", _ + "Name", _ + "Address", _ + "Mobile" _ + )) + '"Block Reason" _ + SetWidths(ctx, Array( _ + Array("Area", 1000), _ + Array("ID", 0), _ + Array("Name", 3000), _ + Array("Address", 8000), _ + Array("Mobile", 2000) _ + )) + ElseIf reportType = "SBC"Then + ApplyTheme(oDoc, "pumpkin.ots") + RemoveColumnsExcept(ctx, Array( _ + "ID", _ + "Name", _ + "Address", _ + "Mobile", _ + "Area", _ + "No Of Cylinder" _ + )) + SetWidths(ctx, Array( _ + Array("ID", 0), _ + Array("Name", 3000), _ + Array("Address", 8000), _ + Array("Mobile", 0), _ + Array("Area", 0) _ + )) + ElseIf reportType = "EKYC" Then + ApplyTheme(oDoc, "nature.ots") + enableGroupReports = True + + RemoveColumnsExcept(ctx, Array( _ + "Area", _ + "ID", _ + "Name", _ + "Address", _ + "Mobile" _ + )) + SetWidths(ctx, Array( _ + Array("Area", 2000), _ + Array("ID", 0), _ + Array("Name", 3000), _ + Array("Address", 8500), _ + Array("Mobile", 2000) _ + )) + ElseIf reportType = "VIP" Then + ApplyTheme(oDoc, "green_grapes.ots") + RemoveColumnsExcept(ctx, Array( _ + "Area", _ + "ID", _ + "Name", _ + "Address", _ + "Mobile" _ + )) + SetWidths(ctx, Array( _ + Array("Area", 0), _ + Array("ID", 0), _ + Array("Name", 3000), _ + Array("Address", 8000), _ + Array("Mobile", 0) _ + )) + Else + ErrorLocal$ = "Unknown reportType: '" & reportType & "'" + Exit Sub + End If +End Sub + +Function SegregateEKYCDoneOnline() + ' Array +End Function + +Sub Main(Optional sInputFiles as Variant) + Dim aInputFiles, sInputFile$ + Dim aDoc as Variant, oDoc, oDBDoc, oDispatcher + Dim oOrigSheet, oSheet, oDBSheet, oSheets as Object + Dim oCursor, oTextCursor + Dim sonConf, sonReport, aSettings + + Dim sTheme$, badStyleName$ + Dim idColumn%, mobileColumn%, phoneColumn%, addressColumn%, nameColumn% + Dim groupByColumn%, areaNames as New Collection + Dim rowsToRemove% + Dim highlightedCount as Integer, formatNum as Integer + Dim idRange, bookRange, nameRange + Dim dColumns as Object + Dim headerRange as Object + Dim statusBar as Variant + Dim ctx as New SondageContext + Dim dbCtx as New SondageContext + Dim sGroupBy$, iGroupByColumn% + + Dim cellRangeToCopy as Object + Dim pageStyle as Object + Dim oLocale as new com.sun.star.lang.Locale + + ' Setup args + aInputFiles = Split(sInputFiles, ";") + + ' Initialize Globals + SondageInit(ThisComponent) + If Not ReadSettings() Then Exit Sub + ' TODO Move this to read settings? + sonConf = SondageParseFieldConfiguration() + If ErrorLocal$ <> "" Then Goto ErrorHandler + + ' Use today's date without rounding the time into tomorrow. + tillDate = Date() + badStyleName = "T4" + enableGroupReports = True + + For Each sInputFile in aInputFiles + If IsMissing(sInputFile) Or TypeName(sInputFile) <> "String" Then + If debugInputFile <> "" Then + sInputFile = debugInputFile + isHeadless = False + Else + MsgBox "Please give an input file", 16, "No input given" + GoTo FinalFallback + End If + End If + Next sInputFile + + sInputFile = aInputFiles(0) + + sonReport = SondageInferDocumentType(sonConf.Reports, aInputFiles) + If IsEmpty(sonReport) Then + ErrorLocal = "Cannot infer report configuration for '" & sInputFile & "'" + Goto ErrorHandler + End If + inputType = sonReport.Title + + If reportType = "AUTO" Then + reportType = inputType + End If + + aSettings = sonReport.Settings + sGroupBy = SondageGetPropVal(aSettings, "GroupBy") + + 'If reportType = "PENDING" Then + ' isDBRequired = True + 'End If + + If isDBRequired Then + oDBDoc = SondageImportFile(sonReport, customerDBFile, "com.sun.star.sheet.SpreadsheetDocument", True, False, True) + If ErrorLocal$ <> "" Then Goto ErrorHandler + End If + + ' FIXME The isHidden = False value is hardcoded, but use value from settings + aDoc = SondageImportFiles(sonReport, aInputFiles, "com.sun.star.sheet.SpreadsheetDocument", True, False) + If ErrorLocal$ <> "" Then Goto ErrorHandler + oDoc = aDoc(0) + statusBar = oDoc.CurrentController.StatusIndicator + + If oDoc.CurrentController.hasFrozenPanes() Then + Call UnFreezeSelection(oDoc) + End If + + ctx = SondageGetContext(oDoc.Sheets(0)) + + If ctx.oSheet.IsProtected Then + ctx.oSheet.Unprotect(reportType) + End If + + ' EKYC starts with its header on line 1; never discard it as a preamble. + If reportType <> "EKYC" Then + rowsToRemove = NaiveLastTable(ctx) + RemoveRows(ctx, rowsToRemove) + End If + + 'If oDoc.Sheets.Count <> 1 Then oDoc.Sheets.removeByName("CONSUMERSWorkingCopy") + + ' Copy the first, sheet if there is only one sheet in document + If oDoc.Sheets.Count = 1 Then + If shouldCreateDataPivot = False Then + oDoc.Sheets.copyByName(ctx.oSheet.Name, reportType & "WorkingCopy", 1) + End If + End If + + oDoc.lockControllers() + ' Register Styles + SetCustomBadStyle(oDoc, oLocale, badStyleName) : If ErrorLocal$ <> "" Then Goto ErrorHandler + + ctx.oSheet.Protect(reportType) + + If isDBRequired Then + dbCtx = SondageGetContext(oDBDoc.Sheets(0)) + Call CleanColumnHeaders(dbCtx) + End If + + ctx = SondageGetContext(oDoc.Sheets(1)) + + If ctx.oSheet.Name = reportType & "WorkingCopy" Then + ' It's not possible to create a style even if only one sheet is blocked + Call CleanColumnHeaders(ctx) + End If + + iGroupByColumn = GetHeaderPosition(ctx, sGroupBy) + If iGroupByColumn = -1 Then + ErrorLocal$ = "Cannot proceed, '" & sGroupBy & "' column not found" + Goto ErrorHandler + End If + If iGroupByColumn > 0 Then + ctx.oSheet.getColumns().insertByIndex(0, 1) + ctx.oSheet.moveRange(ctx.oSheet.getCellByPosition(0, 0).CellAddress, _ + ctx.oSheet.getCellRangeByPosition(iGroupByColumn + 1, 0, iGroupByColumn + 1, ctx.endRow).RangeAddress) + ctx.oSheet.getColumns().removeByIndex(iGroupByColumn + 1, 1) + ctx = SondageGetContext(ctx.oSheet) + End If + + ' FIXME Enable normal Consumer List Generation Later + If shouldSyncWithGVT Then + ReducedPopulateConsumerDetails(gvtSoftwareFolder, ctx.oSheet) + 'PopulateConsumerDetails(gvtSoftwareFolder, ctx.oSheet) + GoTo FinalFallback + End If + + 'Call CleanupProductCode(ctx, endRow) + + ' Filter - Remove unrequired fields + If reportType = "INSPECTION" Then + Call FilterColumn(ctx, "Area", orgCode & "_PortIn", com.sun.star.sheet.FilterOperator.NOT_EQUAL) + Call FilterColumn(ctx, "Inspection Due Now", "Over Due") + Call FilterColumn(ctx, "Mobile", 0, com.sun.star.sheet.FilterOperator.NOT_EQUAL) + ElseIf reportType = "TUBE" Then + Call FilterColumn(ctx, "Area", orgCode & "_PortIn", com.sun.star.sheet.FilterOperator.NOT_EQUAL) + Call FilterColumn(ctx, "Tube Change Due Now", "Over Due") + Call FilterColumn(ctx, "Mobile", 0, com.sun.star.sheet.FilterOperator.NOT_EQUAL) + ElseIf reportType = "VIP" Then + Call FilterColumn(ctx, "Category", "VIP") + ElseIf reportType = "DORMANT" Then + Call FilterColumn(ctx, "Block Reason", "Dormant") + ElseIf reportType = "REFILL" Then + Call FilterColumn(ctx, "Type", "Domestic", com.sun.star.sheet.FilterOperator.NOT_EQUAL) + End If + + ' Expensive Operation, run after filter + If inputType = "CONSUMERS" Then + ' TODO Sort will not lose it character after filter. This should be above filter + Call SortColumn(ctx, "ID") + SondageJoinVertical(ctx, "ID") + SondageConditionalHorizontalCopy(ctx, "Mobile", "Phone") + End If + + ' TODO Should this be automatic and obtained from ctx? + oCursor = UsedRangeCursor(ctx.oSheet) + + If reportType = "PENDING" Then + ' If the reportFilter is ONLINE, filter it, else highlight + ' TODO Add this feature to Sondage + If reportFilter = "ONLINE" Then + Call FilterColumn(ctx, "Payment Option", "Online Payment", com.sun.star.sheet.FilterOperator.EQUAL) + Else + highlightedCount = HighlightRowWithColumn(ctx, _ + "Payment Option", "Online Payment", RGB(255, 255, 0)) + End If + + ' Justify Leftmost cells to left and Rightmost cells to right + bookRange = GetColumnRange(ctx, "Book") + bookRange.setPropertyValue("HoriJustify", com.sun.star.table.CellHoriJustify.RIGHT) + + FormatRangeAsNumber(oLocale, oDoc.getNumberFormats(), bookRange, "DD/MM") + + tillDate = ComputeOnRange(ctx, "Book", com.sun.star.sheet.GeneralFunction.MAX) + fromDate = ComputeOnRange(ctx, "Book", com.sun.star.sheet.GeneralFunction.MIN) + + SetupConditionalForHighPriority(ctx.oDoc, oLocale, bookRange, badStyleName, "><", 1000, tillDate - priorityThreshold) + ElseIf reportType = "EKYC" Then + highlightedCount = HighlightRowWithColumn(ctx, _ + "Consumer Type", "PMUY", RGB(175, 255, 175)) + End If + + SondageTransformSheet(ctx, sonConf, reportType, "Group Width") + + If ErrorLocal$ <> "" Then Goto ErrorHandler + oCursor = UsedRangeCursor(ctx.oSheet) + + If inputType = "PENDING" Then + if isDBRequired Then + If Not AssertColumn(dbCtx, "Address") Then GoTo ErrorHandler + End If + End If + + Call ShortenDirections(ctx, groupByColumn) + Dim sSortBy$: sSortBy = SondageGetPropVal(aSettings, "SortBy") + If sSortBy <> "" Then + Call SortColumn(ctx, sGroupBy, sSortBy) + Else + Call SortColumn(ctx, sGroupBy) + End If + + If reportType = "PENDING" and isDBRequired Then + Call ColumnJoin(CHR(10), "ID", ctx, "Name", dbCtx, "Address") + End If + + sTheme = SondageGetPropVal(aSettings , "Theme") + If Not IsEmpty(sTheme) Then ApplyTheme(ctx.oDoc, sTheme) + + idRange = GetColumnRange(ctx, "ID") + idRange.setPropertyValue("HoriJustify", com.sun.star.table.CellHoriJustify.LEFT) + + ' Setup exportPrefix and sheetName + tillDateStr = Format(tillDate, "yyyy-mm-dd") + sheetNameSuffix = " - " & reportType & " " & tillDateStr + exportDestDir = tillDateStr & " " & reportType + + headerRange = ctx.oSheet.getCellRangeByPosition(0, 0, ctx.endColumn, 0) + headerRange.CellStyle = "Heading 1" + + pageStyle = ctx.oDoc.StyleFamilies.getByName("PageStyles").getByName("Default") + pageStyle.setPropertyValue("PrintGrid", True) + pageStyle.setPropertyValue("CenterHorizontally", True) + + pageStyle.HeaderIsOn = True + pageStyle.HeaderShared = True + pageStyle.FirstPageHeaderIsShared = True + + ' TODO simplify this logic, recalculate everytime + If highlightedCount <> 0 Then + If reportType = "PENDING" Then + Call SetHeader(pageStyle, Date() & " | FROM: " & fromDate, , "ONLINE: " & CStr(highlightedCount)) + ElseIf reportType ="EKYC" Then + Call SetHeader(pageStyle, "GENERATED ON: " & Date(), , "PMUY: " & CStr(highlightedCount)) + End If + End if + + pageStyle.setPropertyValue("LeftMargin", 0.2 * 2540) + pageStyle.setPropertyValue("RightMargin", 0.2 * 2540) + + ' Change original sheet name + ctx.oSheet.Name = "ALL" & sheetNameSuffix + + ' Clear subtotals if any before exporting area wise + If shouldRunSubtotals Then oCursor.removeSubtotals() + + If enableGroupReports Then + iGroupByColumn = GetHeaderPosition(ctx, sGroupBy) + If iGroupByColumn = -1 Then Goto ErrorHandler + If GenerateIndividualSheets(ctx, sonConf, reportType, sGroupBy, statusBar, False) = False Then + Goto ErrorHandler + End If + End If + + Dim summaryCtx as SondageContext: summaryCtx = ctx + summaryCtx.oSheet = oDoc.getSheets().getByIndex(1) + + Dim sValidationList$ + If reportType = "PENDING" Then + sValidationList = pendingRemarksValidateList + ElseIf reportType = "EKYC" Then + sValidationList = ekycRemarksList + End If + + If sValidationList <> "" Then + ' FIXME Add this check dynamically from config sheet + CreateValidationList(ctx, "Remarks", sValidationList) + End If + + If shouldRunSubtotals Then + Call RunSubtotals(oCursor, groupByColumn, statusBar) + Call ReArrangeResultToHeader(summaryCtx) + End If + + If statusBar Then statusBar.end() + + ' Export summary + If shouldExportPDF Then + ExportAs(oDoc, ctx.oSheet, exportPrefix, exportDestDir, "pdf") + End If + + if shouldExportSummaryEditable Then + ExportAs(oDoc, ctx.oSheet, exportPrefix, exportDestDir, "ods") + End If + + FinalFallback: + If Not IsEmpty(organizeInputsFolder) Then + If Not FileExists(organizeInputsFolder) Then MkDir(organizeInputsFolder) + + Dim sBackupInputFile: sBackupInputFile = organizeInputsFolder & GetPathSeparator() & tillDateStr & " " & reportType & ".csv" + If sBackupInputFile <> sInputFile Then + FileCopy(sInputFile, sBackupInputFile) + End If + End If + + If Environ("USERPROFILE") <> "" Then + ' Assume this is windows + Shell(Environ("COMSPEC"), 1, "/c start "" " & QS(QS(exportPrefix & GetPathSeparator() & exportDestDir))) + End If + If isHeadless Then + ' ThisComponent.Close(True) will close all open documents, we don't want that + ThisComponent.CurrentController.Frame.Close(True) + End If + + ErrorHandler: + If statusBar Then statusBar.end() + + ' This is the target document, so we close it everytime when not debugging + If Not IsNull(oDBDoc) and debugInputFile = False Then + oDoc.unlockControllers() + oDoc.Close(True) + End If + + ' Only close the DB file, when we are not debugging + If Not IsNull(oDBDoc) and debugInputFile = False Then + oDBDoc.unlockControllers() + oDBDoc.Close(True) + End If + + If ErrorLocal$ <> "" Then + MsgBox ErrorLocal$, 16, "FATAL Subfunction Error" + Exit Sub + End If + + If Erl <> 0 Then + MsgBox "Line " & Erl & ": "& Error$, 16, "FATAL Main Error" + On Error GoTo 0 + Exit Sub + End If + + If removeInputFileAfterSuccess Then + Kill(sInputFile) + End If +End Sub + +Function CopyRange(dstCtx as SondageContext, srcCtx as SondageContext, startRow&, endRow&) + ' Calculation for selecting the proper range + ' start end + '1 : endColumn 0 4 + 'groupByColumn + 1 : endColumn 2 4 + '0 : endColumn - 1 4 4 + + ' Copy Header + srcCtx.oSheet.copyRange(dstCtx.oSheet.getCellRangeByName("A1").CellAddress, _ + srcCtx.oSheet.getCellRangeByPosition( _ + srcCtx.startColumn, _ + 0, srcCtx.endColumn, 0).RangeAddress) + + ' Copy Contents + srcCtx.oSheet.copyRange(dstCtx.oSheet.getCellRangeByName("A2").CellAddress, _ + srcCtx.oSheet.getCellRangeByPosition(_ + srcCtx.startColumn, _ + startRow, _ + srcCtx.endColumn, _ + endRow).RangeAddress) +End Function + +Function GenerateIndividualSheets(ctx as SondageContext, sonConf as SondageConfiguration, reportType, sGroupByColumn$, statusBar as Variant, Optional sortColumn as Boolean) as Boolean + ' WARNING: This function requires a sorted column, unless specied as False in sortColumn + ' In that case, the column is assumed sorted + Dim dstSheet as Variant + Dim startRow& + Dim a$, sheetName$ + Dim iRow&, iGroupBy% + Dim dstCtx as New SondageContext + GenerateIndividualSheets = False + + statusBar.start("Creating " & sGroupByColumn & " Wise", 100) + + iGroupBy = GetHeaderPosition(ctx, sGroupByColumn) + If iGroupBy <> 0 Then + ErrorLocal$ = "Cannot generate group reports: '" & sGroupByColumn & "' must be the first column" + Exit Function + End If + + ctx.startColumn = 1 + + If IsMissing(sortColumn) Then sortColumn = True + iRow = ctx.startRow + Do While iRow <= ctx.endRow + a = ctx.oSheet.getCellByPosition(iGroupBy, iRow).getString() + If a = "" Then Exit Do + startRow = iRow + + Do While iRow <= ctx.endRow + If ctx.oSheet.getCellByPosition(iGroupBy, iRow).getString() <> a Then Exit Do + iRow = iRow + 1 + Loop + + statusBar.setText("Generating report for " & a) + statusBar.setValue((iRow / ctx.endRow) * 100) + sheetName = a & sheetNameSuffix + + ' Prepare Destination sheet + dstSheet = NewSheet(ctx.oDoc, sheetName) + dstCtx = SondageGetContext(dstSheet) + dstCtx.endRow = ctx.endRow + dstCtx.endColumn = ctx.endColumn + CopyRange(dstCtx, ctx, startRow, iRow - 1) + + ' TODO Copy only required cells, instead of copying and deleting for GroupBys + Dim testAreaColumn: testAreaColumn = GetHeaderPosition(dstCtx, sGroupByColumn) + if testAreaColumn > 0 Then + dstSheet.getColumns().removeByIndex(testAreaColumn, 1) + End If + + SondageTransformSheet(dstCtx, sonConf, reportType, "Width") + + If shouldExportPDF Then + if ExportAs(dstCtx.oDoc, dstCtx.oSheet, exportPrefix, exportDestDir, "pdf") = False Then Exit Function + End If + Loop + GenerateIndividualSheets = True +End Function + +Function RunSubtotals(oCursor, iColumn, Optional statusBar as Variant) + If Not IsMissing(statusBar) Then statusBar.setText("Running subtotals") + Dim oSubtotalDesc : oSubtotalDesc = oCursor.createSubTotalDescriptor(true) + Dim oSubtotalColumn(0) as new com.sun.star.sheet.SubTotalColumn + + With oSubtotalColumn(0) + .Column = iColumn + .Function = com.sun.star.sheet.GeneralFunction.COUNT + End With + oSubtotalDesc.addNew(oSubtotalColumn, iColumn) + oCursor.applySubtotals(oSubtotalDesc, true) +End Function + +Sub SubstituteContent(oDoc, oShape, oProduct) + ' TODO Maybe change from If Not to If and show error? + If oShape.getName() = "" Then + Exit Sub + End If + If oShape.getName() = "StovePrice" Then + If oProduct.Price <> 0 Then + oShape.setString(CURRENCY_UNIT & CStr(oProduct.Price)) + End If + ElseIf oShape.getName() = "ProductBlurb" Then + If oProduct.Description <> "" Then + oShape.setString(oProduct.Description) + End If + ElseIf oShape.getName() = "ProductTitle" Then + If IsEmpty(oProduct.Title) Then + oShape.setString(oProduct.Title) + End If + End If +End Sub + +Function GetFirstOpenDocument(docType as String) + Dim oComponents: oComponents = StarDesktop.getComponents() + Dim oDoc + Dim oDocs: oDocs = oComponents.createEnumeration() + Do While oDocs.hasMoreElements() + oDoc = oDocs.nextElement() + If oDoc.supportsService(docType) Then + GetFirstOpenDocument = oDoc + Exit Function + End If + Loop +End Function + +Sub Dialog1Show + With GlobalScope.BasicLibraries + If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools") + End With + Dim oAddBtn + Dim oDialog1 + Dim oColorTbl, oHeaders, oColumn1, oColumn2, oColumn3, oComboBox, oDataModel + oDialog1 = Tools.ModuleControls.LoadDialog("Standard", "Dialog1") + oAddBtn = oDialog1.getControl("AddBtn").getModel() + oColorTbl = oDialog1.getControl("ColorTable").getModel() + oColorTbl.Width = 150 ' TODO get width value from column + + oColumn1 = createUnoService( "com.sun.star.awt.grid.GridColumn") + oColumn2 = createUnoService( "com.sun.star.awt.grid.GridColumn") + oColumn3 = createUnoService( "com.sun.star.awt.grid.GridColumn") + + oColumn1.Title = "Condition" + oColumn1.MaxWidth = 30 + oColumn2.Title = "Value" + oColumn2.MaxWidth = 30 + oColumn3.Title = "Color" + + ' Print oColumn3.dbg_properties() + oHeaders = createUnoService("com.sun.star.awt.grid.DefaultGridColumnModel") + oDataModel = createUnoService( "com.sun.star.awt.grid.DefaultGridDataModel") + + oHeaders.addColumn(oColumn1) + oHeaders.addColumn(oColumn2) + oHeaders.addColumn(oColumn3) + + oColorTbl.GridDataModel = oDataModel + + oColorTbl.ColumnModel = oHeaders + oDataModel.addRow("1", Array(">", "45", "#ff0000")) + oDialog1.Execute() +End Sub + +Sub SetCustomBadStyle(oDoc, oLocale, styleName as String) + Dim oCellStyles + Dim oStyle + Dim formatNum% + oCellStyles = oDoc.StyleFamilies("CellStyles") + If oCellStyles.hasByName(styleName) Then + oCellStyles.removeByName(styleName) + End If + oStyle = oDoc.createInstance("com.sun.star.style.CellStyle") + oCellStyles.insertByName(styleName, oStyle) + oStyle = oCellStyles.getByName(styleName) + oStyle.CellBackColor = RGB(255, 0, 0) + formatNum = GetNumberFormatNumber(oLocale, oDoc.getNumberFormats(), "DD/MM") + If formatNum = -1 Then + ErrorLocal$ = "WARNING: Cannot add '" & formatStr & "' as NumberFormat" + Exit Sub + End If + oStyle.NumberFormat = formatNum +End Sub + +Sub SetupConditionalForHighPriority(oDoc, oLocale, oRange, styleName$, _ + opCond$, formula1 as Variant, Optional formula2 as Variant) + + ' TODO Rework this function to automagically handle dates + Dim oConFormat + Dim oCondition(3) as new com.sun.star.beans.PropertyValue + + 'BasicLibraries.LoadLibrary("Sondage") + + ' FIXME This may very well crash on some operations, I have no idea, because + ' I have not tested it + If IsMissing(formula2) Then formula2 = "0" + + If TypeName(formula1) = "Date" Then + formula1 = CStr(CLng(formula1)) + End If + + If TypeName(formula2) = "Date" Then + formula2 = CStr(CLng(formula2)) + End If + + With oCondition(0) + .Name = "Operator" + .Value = SondageGetCondTypeFromString(opCond) + End With + With oCondition(1) + .Name = "Formula1" + .Value = formula1 + End With + With oCondition(2) + .Name = "Formula2" + .Value = formula2 + End With + With oCondition(3) + .Name = "StyleName" + .Value = styleName + End With + + oConFormat = oRange.ConditionalFormat + oConFormat.clear() + oConFormat.addNew(oCondition) + oRange.ConditionalFormat = oConFormat +End Sub + +Sub ShowFilterOptions() + Dim args(), i% + args() = StarDesktop.CurrentComponent.getArgs() + For i = 0 to uBound(Args()) + If args(i).Name = "FilterOptions" then inputbox args(i).Name,"",cStr(args(i).value) + Next +End Sub
diff --git a/Basic/Standard/HandyTools.bas b/Basic/Standard/HandyTools.bas @@ -0,0 +1,1241 @@ +REM ***** BASIC ***** +Option Explicit + +Type SondageSettings + oFieldAliasesRange as Variant +End Type + +Type SondageContext + oDoc as Variant + oSheet as Variant + oRange as Variant + headerRow& + startColumn& + startRow& + endColumn& + endRow& +End Type + +Private priceListPath as String + +Public Function Env(Value As Variant) As String + Env = Environ(Value) +End Function + +Type Product + Title as Variant ' com.sun.star.text.XText + Price as Integer + Description as String +End Type + +'https://ask.libreoffice.org/t/how-to-know-if-the-file-is-open/77760/7 +Function ReturnComponentIfOpen(Byval filePath As String) as Object + Dim oComp + filePath=ConvertToUrl(filePath) + For Each oComp In StarDesktop.Components + If HasUnoInterfaces(oComp, "com.sun.star.frame.XModel") Then ' component which has URL + If oComp.Url=filePath Then + ReturnComponentIfOpen = oComp + Exit Function + End If + End If + Next oComp +End Function + +Function CreateProperty(key as String, val as Variant) as com.sun.star.beans.PropertyValue + Dim oProp As New com.sun.star.beans.PropertyValue + oProp.Name = key + oProp.Value = val + CreateProperty = oProp +End Function + +Function GetHomePath() as Object + Dim oPathSub + oPathSub = CreateUnoService("com.sun.star.util.PathSubstitution") + GetHomePath = oPathSub.getSubstituteVariable("home") & "/" +End Function + +Function ReadProductFromSheet(oSheet as Object, sProductName as String) as Product + ' TODO FIX: Return the correct Product details instead of first item + Dim oProduct as Product + Dim iPrice + Dim oTitle + Dim iChannel as Integer + Dim oCalcDoc + Dim oCursor, oCell + Dim bProductFound: bProductFound = False + Dim i, j, iRow, iColumn as Integer + Dim sCalcFile: sCalcFile = ConvertToUrl(priceListPath) + + Dim oArgs(0) as new com.sun.star.beans.PropertyValue + oArgs(0).Name = "Hidden" + oArgs(0).Value = True + + oCursor = UsedRangeCursor(oSheet) + iRow = oCursor.getRows().Count() + iColumn = oCursor.getColumns().getCount() + + ' TODO Use Column headers for retrieving data + For i = 1 To iRow - 1 + oCell = oSheet.getCellByPosition(0, i) + If oCell.String = sProductName Then + bProductFound = True + Goto CLOSE_SHEET_AND_REFLECT: + End If + Next i + +CLOSE_SHEET_AND_REFLECT: + If bProductFound Then + oTitle = oSheet.getCellByPosition(1, i).getString() + oProduct.Title = oCursor + '############################ + oProduct.Price = oSheet.getCellByPosition(3, i).getValue() + End If + ReadProductFromSheet = oProduct + oCalcDoc.close(True) +End Function + +Function GetNumberFormatNumber(oLocale as com.sun.star.lang.Locale, ByRef oFormats, formatStr as String) as Integer + Dim formatNum as Long + GetNumberFormatNumber = -1 + formatNum = oFormats.queryKey(formatStr, oLocale, False) + ' add formatStr if it doesn't exist + If formatNum = -1 Then + formatNum = oFormats.addNew(formatStr, oLocale) + End If + GetNumberFormatNumber = formatNum +End Function + +Sub FormatRangeAsNumber(oLocale as com.sun.star.lang.Locale, ByRef oFormats, oRange, formatStr as String) + ' BASIC equivalent of 'Text to Columns' + Dim formatNum as Long, i as Integer + Dim oReplace + oReplace = oRange.createReplaceDescriptor() + + If oRange.getCellByPosition(0,0).getValue() = 0 Then + formatNum = GetNumberFormatNumber(oLocale, oFormats, formatStr) + If formatNum = -1 Then + ErrolLocal$ = "Cannot add " & formatStr & " as NumberFormat" + Exit Sub + End If + ' https://ask.libreoffice.org/t/macro-calc-convert-column-to-date-similar-text-to-columns/92168/20 + With oReplace + .searchString = ".+" + .replaceString = "&" + .SearchRegularExpression = True + End With + + oRange.NumberFormat = formatNum + oRange.replaceAll(oReplace) + End If +End Sub + +Function GetColumnRange(ctx as SondageContext, columnName as String, Optional shouldIncludeHeader as Boolean) as Object + Dim iHeaderPos + If IsMissing(shouldIncludeHeader) Then shouldIncludeHeader = False + iHeaderPos = GetHeaderPosition(ctx, columnName) + If iHeaderPos = -1 Then + GetColumnRange = ctx.oSheet.getCellRangeByPosition(0, 0, 0, 0) + Exit Function + End If + GetColumnRange = ctx.oSheet.getCellRangeByPosition(iHeaderPos, IIf(shouldIncludeHeader, ctx.headerRow, ctx.startRow), iHeaderPos, ctx.endRow) +End Function + +Function RemoveColumns(ctx as SondageContext, columnNames) as Long + Dim columnName as String + Dim iHeader as Integer + RemoveColumns = ctx.endColumn + For Each columnName in columnNames + iHeader = GetHeaderPosition(ctx, columnName) + If iHeader <> -1 Then + ctx.oSheet.getColumns().removeByIndex(iHeader, 1) + ctx.endColumn = ctx.endColumn - 1 + End If + Next + RemoveColumns = ctx.endColumn +End Function + +Function RemoveColumnsExcept(ctx as SondageContext, columnNames as Variant) as Long + Dim headerStr as String, columnName as String + Dim i% : i = 0 + Dim rI% : rI = 0 + Dim columnsToRemove(ctx.endColumn) as String + Dim headerRange, headerData + Dim found as Boolean : found = False + RemoveColumnsExcept = ctx.endColumn + + headerRange = ctx.oSheet.getCellRangeByPosition(0, 0, ctx.endColumn, 0) + headerData = headerRange.getFormulaArray() + + ' TODO Handle condition when columnNames does not have valid header + ' This causes an extra string element in the array + For i = 0 To UBound(headerData(0)) + headerStr = headerData(0)(i) + found = False + For Each columnName in columnNames + If headerStr = columnName Then + found = True + Exit For + End If + Next columnName + If Not found Then + columnsToRemove(rI) = headerStr + rI = rI + 1 + End If + Next i + + If i = 0 Then + Exit Function + End If + + If rI = 0 Then + RemoveColumnsExcept = ctx.endColumn + Exit Function + End If + ReDim Preserve columnsToRemove(rI - 1) + + RemoveColumnsExcept = RemoveColumns(ctx, columnsToRemove) +End Function + +Sub ApplyTheme(ByRef oDoc, sFileName As String) + Dim oFamilies + Dim aOptions(0) as New com.sun.star.beans.PropertyValue + Dim stylesDir() + Dim StylePath as String + GlobalScope.BasicLibraries.loadLibrary("Tools") + oFamilies = oDoc.StyleFamilies + StylesDir = GetOfficeSubPath("Template", "wizard/styles/") + StylePath = StylesDir & sFileName + aOptions(0).Name = "OverwriteStyles" + aOptions(0).Value = true + oFamilies.loadStylesFromURL(StylePath, aOptions()) +End Sub + +Function NaiveLastTable(ctx as SondageContext) as Long + ' Return the row position last table that is separated by an empty row + Dim oRows + Dim iRow as Long + Dim usedRange + NaiveLastTable = 0 + oRows = ctx.oRange.Rows + + For iRow = 0 To oRows.getCount() - 1 + If oRows.getByIndex(iRow).computeFunction(com.sun.star.sheet.GeneralFunction.COUNT) = 0 Then + NaiveLastTable = iRow + End If + Next +End Function + +Function IsValidFileName(fileName as String) as Boolean + Dim invalidChars as String : invalidChars = "\/:*?""<>|" + Dim c as String + Dim i as Integer + IsValidFileName = False + For i = 1 To Len(fileName) + c = Mid(fileName, i, 1) + If InStr(invalidChars, c) > 0 Then + Print "Invalid character '" & c & "' found in '" & fileName & "'" + Exit Function + End If + Next + IsValidFileName = True +End Function + +Function ExportAs(oDoc, oSheet, exportPrefix$, exportDestDir$, exportExt$) as Boolean + Dim cursor as Object + Dim args(2) as New com.sun.star.beans.PropertyValue + Dim fd(2) as New com.sun.star.beans.PropertyValue + Dim fileName as String, fileUrl + ExportAs = False + On Error GoTo ErrorHandler + + If Not IsValidFileName(oSheet.Name) Then + ErrorLocal$ = "Sheet has invalid characters for file export" + Exit Function + End If + + 'If Right(exportPrefix, 1) = "/" Or Right(exportPrefix, 1) = "\" Then + ' exportPrefix = Left(exportPrefix, Len(exportPrefix) - 1) + + fileUrl = ConvertToUrl(exportPrefix) + If Not FileExists(fileUrl) Then + ErrorLocal$ = "FATAL: " & fileUrl & " does not exist" + Exit Function + End If + + fileUrl = ConvertToUrl(exportPrefix & GetPathSeparator() & exportDestDir) + If Not FileExists(fileUrl) Then + Mkdir fileUrl + End If + + fileName = exportPrefix & GetPathSeparator() & exportDestDir & GetPathSeparator() & oSheet.Name & "." & exportExt + fileUrl = ConvertToUrl(fileName) + + WIth fd(0) : .Name = "Selection" : .Value = UsedRangeCursor(oSheet) : End With + ' Disabled, because it conflicts with selection + With fd(1) : .Name = "SinglePageSheets" : .Value = False : End With + With fd(2) : .Name = "IsSkipEmptyPages" : .Value = True : End With + + If exportExt = "pdf" Then + With args(0) : .Name = "FilterName" : .Value = "calc_pdf_Export" : End With + ElseIf exportExt = "ods" Then + With args(0) : .Name = "FilterName" : .Value = "calc8" : End With + Else + ErrorLocal$ = "FATAL: Export type '" & exportExt & "' not handled" + End If + + With args(1) : .Name = "FilterData" : .Value = fd : End With + With args(2) : .Name = "Overwrite" : .Value = True : End With + + oDoc.storeToURL(fileUrl, args) + ExportAs = True + Exit Function +ErrorHandler: + ErrorLocal$ = "FATAL: ExportPDF: Unknown error" +End Function + +Sub ListOfActiveCustomers() + Dim oSheet, destSheet, cursor, oRange + Dim startRow as Long + Dim endRow as Long + Dim startColumn as Long + Dim endColumn as Long + Dim requiredFields() + Dim requiredFieldIndices() as Integer + Dim iColumn as Integer, iRequiredField as Integer + Dim headerCellStr as String + + oSheet = ThisComponent.Sheets(0) + cursor = UsedRangeCursor(oSheet) + + ' Skip Header + startRow = NaiveLastTable(cursor) + endRow = cursor.RangeAddress.EndRow + endColumn = cursor.RangeAddress.EndColumn + ' TODO Use data from PhoneNumber if some MobileNumber is missing + requiredFields = Array("ConsumerNumber", "ConsumerName", "MobileNumber", "AreaCodeDesc", "LastDelivDate") + 'oSheet.Rows.removeByIndex(0, 3) + + For iColumn = startColumn To endColumn + headerCellStr = oSheet.getCellByPosition(iColumn, startRow, iColumn, startRow).getString() + For iRequiredField = 0 To UBound(requiredFields) + If headerCellStr = requiredFields(iRequiredField) Then + ' TODO Allocate memory before hand and use a tracker index? + ReDim Preserve requiredFieldIndices(UBound(requiredFieldIndices) + 1) + requiredFieldIndices(UBound(requiredFieldIndices)) = iColumn + End If + Next iRequiredField + Next iColumn + destSheet = NewSheet(oDoc, "SBC Connection") + + Print Join(requiredFieldIndices) + + ' TODO Ignore the Header Table if it exists + ' i.e. If two tables exists, assume the first one to be header table + ' and ignore it while copying to new sheet + + ' Copy the cells in 'requiredFieldIndices' to 'destSheet' +End Sub + +Sub CombineFiles(sFolder as String, fileRegex as String) + Dim sFile + Dim sFiles as Variant + Dim i as Integer: i = 0 + Dim oDoc as Variant + Dim dstSheet + Dim oDstCursor + Dim oSrcCursor + Dim rangeAddress + Dim oSheet + If Not FileExists(sFolder) Then + ErrorLocal$ = "sFolder path: '" & sFolder & "' does not exist" + Exit Sub + End If + + sFile = Dir( sFolder & "\" & fileRegex, 0) + + If IsEmpty(oDoc) Then + oDoc = ImportReportFile(sFolder & "\" & sFile, False) + if IsEmpty(oDoc) Then + ErrorLocal$ = "Failed to get Document for " & sInputFile + Exit Sub + End If + If Not oDoc.supportsService( "com.sun.star.sheet.SpreadsheetDocument") Then + Print "The imported document is not a sheet document" + End If + dstSheet = oDoc.getSheets().getByIndex(0) + End If + + sFile = Dir() + Do While(sFile <> "") + oDstCursor = UsedRangeCursor(dstSheet) + i = i + 1 + + oDoc.getSheets().insertNewByName(CStr(i), i) + oSheet = oDoc.getSheets().getByIndex(i) + If IsEmpty(oSheet) Then + ErrorLocal$ = "Cannot create new sheet" + Exit Sub + End If + + oSheet.link(ConvertToUrl(sFolder & "\" & sFile), CStr(i), CSV_FILTER_NAME, PENDING_CSV_FILTER_OPTIONS, com.sun.star.sheet.SheetLinkMode.NORMAL) + + oSrcCursor = UsedRangeCursor(oSheet, 1) + + dstSheet.copyRange(dstSheet.getCellByPosition(0, oDstCursor.RangeAddress.EndRow + 1).getCellAddress(), oSrcCursor.RangeAddress) + sFile = Dir() + Loop +End Sub + +Function UsedRangeCursor(oSheet as Variant, Optional rowsToSkip as Integer) as Variant + Dim oCursor + Dim i as Integer + oCursor = oSheet.createCursor() + oCursor.gotoStartOfUsedArea(False) + If Not IsMissing(rowsToSkip) Then oCursor.gotoOffset(0, rowsToSkip, False) + oCursor.gotoEndOfUsedArea(True) + UsedRangeCursor = oCursor +End Function + +Function GetProductNames() as Variant + GetProductNames = Array( _ + 5300, "14.2", _ + 5350, "14.2s", _ + ) + ' TODO finish deploying the extension and push extension to git +End Function + +Function ProductDescrption(productCode as Integer) as String + Dim i as Long + Dim productNames: productNames = GetProductNames() + ProductDescription = "" + For i = 0 To UBound(productNames) Step 2 + If productNames(i) = productCode Then + ProductDescription = productNames(i + 1) + End If + Next i +End Function + +Function GetValueForKey(oRange as Variant, key as String, Optional valueOffset%) as Object + ' Returns a ScCellObj + Dim oSearchRange + Dim oSearchDescriptor + Dim oCell + + If oRange.Columns.Count < 2 Then + MsgBox "GetValueForKeyCannot have columns less than 2", 16 + GetValueForKey = oCell + Exit Function + End If + + oSearchRange = oRange.getCellRangeByPosition(0, 0, 0, oRange.Rows.Count - 1) + oSearchDescriptor = oSearchRange.createSearchDescriptor() + With oSearchDescriptor + .SearchString = key + .SearchWords = True + .SearchCaseSensitive = True + End With + oCell = oSearchRange.findFirst(oSearchDescriptor) + + If Not IsNull(oCell) Then + If IsMissing(valueOffset) Then + valueOffset = oCell.RangeAddress.StartColumn + 1 + End If + oCell = oRange.getCellByPosition( valueOffset, _ + oCell.RangeAddress.StartRow _ + ) + End If + GetValueForKey = oCell +End Function + +Function UserFriendlyName(str as String) as String + ' Checks headerName and headerNameMatches for the string 'str', + ' If it's not available there, a naïve implementation adds spacing to 'str' + Dim l as Long + Dim c as String + Dim i as Long + Dim prevChar$ + Dim oValCell + + str = Trim(str) + oValCell = GetValueForKey(GlobalSondageSettings.oFieldAliasesRange, str) + If Not IsNull(oValCell) Then + UserFriendlyName = oValCell.String + Exit Function + End If + + l = Len(str) + ' Check with header "database" + For i = 0 To l + c = Mid(str, i + 1, 1) + If i > 1 And (c > "A" And c < "Z") Then + ' Only prepend space if 'c' is not the first character... + ' or previous char doesn't have space + UserFriendlyName = UserFriendlyName & IIf(prevChar = " ", "", " ") & c + Else + UserFriendlyName = UserFriendlyName & c + End If + prevChar = c + Next +End Function + +Sub SortColumn(ctx as SondageContext, columnName1 as String, Optional columnName2 as String) + Dim iHeaderPos as Long + Dim oSortFields(1) as new com.sun.star.util.SortField + Dim oSortDesc(1) as new com.sun.star.beans.PropertyValue + + iHeaderPos = GetHeaderPosition(ctx, columnName1) + If iHeaderPos = -1 Then + Exit Sub + End If + + + ' Area + oSortFields(0).Field = iHeaderPos + oSortFields(0).SortAscending = True + + ' FIXME This should be handled from the sheet settings + If Not IsMissing(columnName2) Then + iHeaderPos = GetHeaderPosition(ctx, columnName2) + If iHeaderPos = -1 Then + Exit Sub + End If + oSortFields(1).Field = iHeaderPos + oSortFields(1).SortAscending = True + End If + + oSortDesc(0).Name = "SortFields" + oSortDesc(0).Value = oSortFields + oSortDesc(1).Name = "ContainsHeader" + oSortDesc(1).Value = True + + ctx.oRange.Sort(oSortDesc) +End Sub + +Function NewSheet(oDoc, sheetName as String) as Object + Dim sheets as Object + sheets = oDoc.Sheets() + If Not sheets.hasByName(sheetName) Then + sheets.insertNewByName(sheetName, sheets.getCount()) + End If + NewSheet = sheets.getByName(sheetName) +End Function + +Sub CleanColumnHeaders(ctx as SondageContext) + Dim cell as Object + Dim neatName as String + Dim i as Integer + For i = ctx.startColumn To ctx.endColumn + cell = ctx.oSheet.getCellByPosition(i, ctx.headerRow) + neatName = cell.getString() + neatName = UserFriendlyName(neatName) + cell.setString(neatName) + Next +End Sub + +Sub RemoveExtraMergeCells(oDoc as Object, oSheet as Object, oRangeAddress as Variant) + Dim oRange as Object + Dim oSortFields(0) as new com.sun.star.util.SortField + Dim oSortDesc(0) as new com.sun.star.beans.PropertyValue + Dim endRow as Long + + endRow = oRangeAddress.EndRow + lastColumn = oRangeAddress.EndColumn + + rem set the range on which to sort' + + 'oRange = oSheet.getCellRangeByName("A2:F20") + oRange = oSheet.getCellRangeByPosition(0, 0, lastColumn, 0) + oDoc.getCurrentController().select(oRange) + initialColumnCount = oRange.Columns.getCount() - 1 + deletedColumns = 0 + For j = 0 To (initialColumnCount - deletedColumns) + oCell = oRange.getCellByPosition(j, 0) + con = oCell.String + If con = "" Then + oRange.Columns.removeByIndex(j, 1) + deletedColumns = deletedColumns - 1 + Else + Print con + End If + Next +End Sub + +Sub UnFreezeSelection(oDoc as Object) + Dim dispatcher as Object + dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") + dispatcher.executeDispatch(oDoc.getCurrentController().getFrame(), ".uno:FreezePanes", "", 0, Array()) +End Sub + +Function GetHeaderPosition(ctx as SondageContext, searchString$, Optional isRoughHeaderMatch as Boolean) as Integer + Dim iColumn as Integer + Dim oCell as Object + Dim cellString as String + GetHeaderPosition = -1 + If IsMissing(isRoughHeaderMatch) Then isRoughHeaderMatch = False + If searchString = "" Then + Exit Function + End If + + For iColumn = ctx.startColumn To ctx.endColumn + oCell = ctx.oSheet.getCellByPosition(iColumn, ctx.headerRow) + cellString = oCell.String + If cellString = "" Then + 'ErrorLocal$ = "BAD ARGUMENT: Cannot have empty columns within UsedRange, endColumn is " & CStr(endColumn) + Exit Function + End If + + ' TODO Implement regex matching + If isRoughHeaderMatch = True Then + If InStr(cellString, searchString) Then + GetHeaderPosition = iColumn + Exit Function + End If + ElseIf cellString = searchString Then + GetHeaderPosition = iColumn + Exit Function + End If + Next iColumn +End Function + +Function HighlightRowWithColumn(ctx as SondageContext, _ + highlightColumnName, highlightValue, Optional highlightColor as Long) as Long + Dim currentStr as String + Dim oCell as Object + Dim oCellRange as Object + Dim str as String + Dim iSearchColumn as Long + Dim i as Integer + Dim highlightCount as Long + + If IsMissing(highlightColor) Then + highlightColor = RGB(255, 255, 0) + End If + + ' Search for column position that has highlightBasedOn + iSearchColumn = GetHeaderPosition(ctx, highlightColumnName) + If iSearchColumn = -1 Then Exit Function + For i = ctx.startRow To ctx.endRow + oCell = ctx.oSheet.getCellByPosition(iSearchColumn, i) + If oCell.getString() = highlightValue Then + oCellRange = ctx.oSheet.getCellRangeByPosition(0, i, ctx.endColumn, i) + oCellRange.CellBackColor = highlightColor + highlightCount = highlightCount + 1 + End If + Next i + HighlightRowWithColumn = highlightCount +End Function + +Function ComputeOnRange(ctx as SondageContext, columnName as String, computeFunc%) as Long + Dim headerPos + Dim column + Dim val + headerPos = GetHeaderPosition(ctx, columnName) + If headerPos = -1 Then + ErrorLocal$ = "Cannot find a column header that starts with '" & columnName & "'" + Exit Function + End If + ' TODO Check if the column we are searching, actually has date values. + column = ctx.oSheet.getCellRangeByPosition(headerPos, 1, headerPos, ctx.endRow) + ComputeOnRange = column.computeFunction(computeFunc) +End Function + +Sub ColumnJoin(joinChar$, idColumnName, dstCtx as SondageContext, dstColumnName$, srcCtx as SondageContext, srcColumnName$) + Dim i&, j& + Dim dstEndRow&, dstEndColumn%, srcEndRow&, srcEndColumn% + Dim dstColumnIdx%, srcColumnIdx% + Dim dstStr$, dstCell + Dim dstRange, srcRange, srcRangeAddress, dstRangeAddress + Dim oTextCursor, oService, statusBar + statusBar = ThisComponent.CurrentController.StatusIndicator + oService = CreateUNOService("com.sun.star.sheet.FunctionAccess") + + dstRange = UsedRangeCursor(dstCtx.oSheet) + dstRangeAddress = dstRange.RangeAddress + srcRange = UsedRangeCursor(srcCtx.oSheet) + srcRangeAddress = srcRange.RangeAddress + + dstEndRow = dstRangeAddress.EndRow + srcEndRow = srcRangeAddress.EndRow + + dstColumnIdx = GetHeaderPosition(dstCtx, dstColumnName) + srcColumnIdx = GetHeaderPosition(srcCtx, srcColumnName) + + + Dim srcColumnIdIdx: srcColumnIdIdx = GetHeaderPosition(srcCtx, idColumnName) + Dim newSrcRange + newSrcRange = srcSheet.getCellRangeByPosition(srcColumnIdIdx, srcCtx.startRow, srcCtx.endColumn, srcCtx.endRow) + + Dim dstColumnIdIdx: dstColumnIdIdx = GetHeaderPosition(dstCtx, idColumnName) + + statusBar.start("Merging Columns", 100) + For i = dstStartRow To dstEndRow + Dim srcCell + Dim srcStr$ + Dim what$ + + statusBar.setText("Merging " & CStr(i) & "/" & dstEndRow) + statusBar.setValue((i / dstEndRow) * 100) + + dstCell = dstRange.getCellByPosition(dstColumnIdx, i) + dstStr = dstCell.getText().String + what = dstRange.getCellByPosition(dstColumnIdIdx, i).getText().String + + srcStr = oService.callFunction("VLOOKUP", Array(what, newSrcRange, srcColumnIdx, True)) + + + dstCell.getText().setString(dstStr & joinChar & srcStr) + + oTextCursor = dstCell.getText().createTextCursor() + oTextCursor.gotoStart(False) + oTextCursor.goRight(Len(dstStr), True) + 'oTextCursor.CharWeight = com.sun.star.awt.FontWeight.BOLD + oTextCursor.goRight(1, False) + oTextCursor.gotoEnd(True) + oTextCursor.CharHeight = 7 + srcStr = "" + what = "" + Next + statusBar.end() +End Sub + +' TODO Use a general function that takes arrays +' and instead of the function ShortenDirections, use +' ReplaceArrays to make it more usable across other projects. +Sub ShortenDirections(ctx as SondageContext, columnIdx as Integer) + 'Shorten East as E. etc + Dim toReplace() as String + Dim toReplaceWith() as String + Dim i as Long + Dim oDescriptor + Dim oColumn + Dim columnToReplace + oColumn = ctx.oSheet.getColumns().getByIndex(columnIdx) + ' TODO arrange it with convention + toReplace() = Array("East", "West", "South", "North") + toReplaceWith() = Array("E.", "W.", "S.", "N.") + oDescriptor = oColumn.createReplaceDescriptor() + For i = LBound(toReplace) To UBound(toReplace) + With oDescriptor + .SearchString = toReplace(i) + .ReplaceString = toReplaceWIth(i) + End With + oColumn.replaceAll(oDescriptor) + Next i +End Sub + +Sub FilterColumn(ctx as SondageContext, filterColumnName as String, filterContent as Variant, Optional filterOperator as Variant, Optional filterUseRegex as Boolean) + Dim oFilterDesc + Dim filterRange, oRange + Dim oCursor, o, oDescriptor + 'Dim oColumnHeader + Dim newColumn : newColumn = ctx.endColumn + 1 + Dim oFields(0) as new com.sun.star.sheet.TableFilterField + Dim filterCount as Long + + If IsMissing(filterOperator) Then filterOperator = com.sun.star.sheet.FilterOperator.EQUAL + If IsMissing(filterUseRegex) Then filterUseRegex = False + + 'On Error Goto ErrorHandler + + oRange = ctx.oSheet.getCellRangeByPosition(newColumn, 0, newColumn, ctx.endRow) + 'oColumnHeader = oRange.getCellByPosition(0, 0) + 'oColumnHeader.setString("0") + + oDescriptor = ctx.oSheet.createReplaceDescriptor() + + filterRange = GetColumnRange(ctx, filterColumnName) + oFilterDesc = filterRange.createFilterDescriptor(True) + + With oFields(0) + .Field = filterRange.RangeAddress.StartColumn + .IsNumeric = IsNumeric(filterContent) + .Operator = filterOperator + .StringValue = filterContent + .NumericValue = filterContent + End With + + oFilterDesc.setFilterFields(oFields()) + oFilterDesc.ContainsHeader = True + oFilterDesc.UseRegularExpressions = filterUseRegex + ctx.oSheet.filter(oFilterDesc) + + ' TODO Check if there is a way to remove the 50,000 limit + 'oRange.fillSeries(com.sun.star.sheet.FillDirection.TO_BOTTOM, com.sun.star.sheet.FillMode.SIMPLE, 0, 1, 50000) + 'SortColumn(ctx.oSheet, 0, 1, newColumn, endRow, "0") + + 'filterCount = oRange.computeFunction(com.sun.star.sheet.GeneralFunction.COUNT) + 'ctx.oSheet.Rows.removeByIndex(filterCount, (ctx.endRow - filterCount) + 1) + +'ErrorHandler: + 'ctx.oSheet.filter(ctx.oSheet.createFilterDescriptor(True)) + 'ctx.oSheet.Columns.removeByIndex(newColumn, 1) + 'Reset +End Sub + +Sub SetHeader(ByRef oPageStyle, Optional sLeftHeader$, Optional sCenterHeader$, Optional sRightHeader) + Dim oHeader + Dim oText + Dim oTextCursor + + oHeader = oPageStyle.RightPageHeaderContent + + If Not IsMissing(sLeftHeader) Then + oText = oHeader.LeftText + oTextCursor = oText.createTextCursor() + oText.insertString(oTextCursor, sLeftHeader, true) + End If + + If Not IsMissing(sCenterHeader) Then + oText = oHeader.CenterText + oTextCursor = oText.createTextCursor() + oText.insertString(oTextCursor, sCenterHeader, true) + End If + + If Not IsMissing(sRightHeader) Then + oText = oHeader.RightText + oTextCursor = oText.createTextCursor() + oText.insertString(oTextCursor, sRightHeader, true) + End If + + oPageStyle.RightPageHeaderContent = oHeader +End Sub + +Sub SondageRestructureColumns(ctx as SondageContext, aColumnWidth as Variant) + ' columnWidthArray has values like Array(Array("Area", 0), Array("ID", 2000)) + ' 0 means autofill + Dim columnWidth, iField% + Dim sField$, iWidth as Variant + Dim oColumn + Dim iHeaderColumn + + For iField = LBound(aColumnWidth) To UBound(aColumnWidth) + sField = aColumnWidth(iField, 0) + iWidth = aColumnWidth(iField, 1) + + If Not IsEmpty(iWidth) Then + iHeaderColumn = GetHeaderPosition(ctx, sField) + If iHeaderColumn = -1 Then + If iWidth = -1 Then + ' No-Op as the field already does not exist + ElseIf iWidth >= 0 Then + SondageAppendColumn(ctx, sField) + iHeaderColumn = GetHeaderPosition(ctx, sField) + Else + ErrorLocal$ = "Cannot find: " & sField & " in headers": Exit Sub + End If + End If + + If iHeaderColumn <> -1 Then + oColumn = ctx.oSheet.getColumns().getByIndex(iHeaderColumn) + If iWidth = -1 Then + 'ctx.oSheet.getColumns().removeByIndex(iHeaderColumn, 1) + oColumn.IsVisible = False + 'ctx.endColumn = ctx.endColumn - 1 + Else + If iWidth = 0 Then + oColumn.OptimalWidth = True + Else + oColumn.Width = iWidth + End If + End if + End If + End If + Next iField + ErrorLocal$ = "" +End Sub + +Sub ReArrangeResultToHeader(ctx as SondageContext, Optional headerStyle$) + ' Assumptions kept local to this transform: + ' - row 1 is the first data/subtotal row; row 0 is left alone + ' - column A contains LibreOffice subtotal Result markers and group labels + ' - generated headers are written from column B through the last used column + ' - cells with style "Result" are subtotal rows + ' - the last Result row is the grand total, mirrored to the top and removed below + ' - one extra top row is for grand total, one is for the first subtotal header + Dim startRow&, nRow&, nCol&, insertRow&, topRow&, totalRow&, removeRow& + Dim oDoc, oRange, oUsedRangeAddress + Dim resultRanges + Dim oAddrs() + Dim oAddr + Dim oFound, oCells + Dim insertRowCell + Dim oSearchDesc + + If IsMissing(headerStyle) Then headerStyle = "Accent 1" + startRow = 1 + + oUsedRangeAddress = UsedRangeCursor(ctx.oSheet).RangeAddress + oRange = ctx.oSheet.getCellRangeByPosition(0, startRow, 0, oUsedRangeAddress.EndRow) + + oSearchDesc = oRange.createSearchDescriptor() + oSearchDesc.SearchStyles = True + oSearchDesc.SearchString = "Result" + + Dim sResult, sGroupBy + Dim oRows, oCols, emptyValue as Object + oRows = ctx.oSheet.getRows() + oCols = ctx.oSheet.getColumns() + Dim colRange + + ' Construct first row and column to be same as others + topRow = startRow + totalRow = -1 + removeRow = -1 + oRows.insertByIndex(startRow, 2) + oUsedRangeAddress.EndRow = oUsedRangeAddress.EndRow + 2 + insertRowCell = ctx.oSheet.getCellByPosition(0, startRow + 1) + insertRowCell.CellStyle = "Result" + startRow = startRow + 1 + + oFound = ctx.oSheet.findFirst(oSearchDesc) + Do While Not IsNull (oFound) + 'Print "Name is: " & oFound.getText().getString() + insertRow = startRow + insertRowCell = ctx.oSheet.getCellByPosition(1, insertRow) + startRow = oFound.RangeAddress.StartRow + If startRow > oUsedRangeAddress.EndRow Then + oFound = emptyValue + Else + sResult = ctx.oSheet.getCellByPosition(0, startRow).getText().String + If sResult <> "" Then + sGroupBy = ctx.oSheet.getCellByPosition(0, startRow - 1).getText().String + colRange = ctx.oSheet.getCellRangeByPosition(1, insertRow, oUsedRangeAddress.EndColumn, insertRow) + colRange.merge(True) + colRange.CellStyle = headerStyle + insertRowCell.getText().setString(sGroupBy & " (" & sResult & ")") + + ' Last Result row is the grand total; mirror it at the top and remove the bottom copy later. + insertRowCell = ctx.oSheet.getCellByPosition(1, topRow) + insertRowCell.getText().setString(sGroupBy & " (" & sResult & ")") + colRange = ctx.oSheet.getCellRangeByPosition(1, topRow, oUsedRangeAddress.EndColumn, topRow) + colRange.merge(True) + colRange.CellStyle = headerStyle + totalRow = startRow + removeRow = insertRow + End If + + oRange = ctx.oSheet.getCellRangeByPosition(0, startRow, 0, oUsedRangeAddress.EndRow) + oFound = ctx.oSheet.findNext(oRange, oSearchDesc) + End If + Loop + + ' Delete bottom-up so the first delete cannot shift the second row number. + If totalRow > removeRow Then + If totalRow <> -1 Then oRows.removeByIndex(totalRow, 1) + If removeRow <> -1 Then oRows.removeByIndex(removeRow, 1) + Else + If removeRow <> -1 Then oRows.removeByIndex(removeRow, 1) + If totalRow <> -1 Then oRows.removeByIndex(totalRow, 1) + End If + oCols.removeByIndex(0, 1) +End Sub + + + + + + + + + + + + + + +sub FiltersToCalc + Dim oFF ' FilterFactory service + Dim oFilterNames ' Array of filter names. + Dim oDoc ' Document created to hold the filter names. + Dim oSheet ' Sheet that will hold the filter information. + Dim oCell ' Cell to update + + Dim i% ' Index Variable. + Dim fProps() ' Properties for each filter. + Dim fp% ' Filter property index + Dim fpCol% ' Column for the specified filter data. + Dim s$ ' Work string that holds some property values. + Dim iUserData% ' For enumerating array property values. + Dim oProp ' A single property. + Dim oArrayData ' Array of user properties. + Dim sPropNames(7) As String + Dim flags As Long + sPropNames(0) = "Name" + sPropNames(1) = "Import" + sPropNames(2) = "Export" + sPropNames(3) = "Options" + sPropNames(4) = "Visible" + sPropNames(5) = "Flags" + sPropNames(6) = "DocumentService" + sPropNames(7) = "UIName" + oFF = createUnoService( "com.sun.star.document.FilterFactory" ) + oFilterNames = oFF.getElementNames() + ' Create a Calc doc and save the filter names to it. + oDoc = StarDesktop.loadComponentFromURL( "private:factory/scalc", "_blank", 0, Array() ) + oSheet = oDoc.getSheets().getByIndex(0) + ' Print the filter names into a document. + For i = LBound( oFilterNames ) To UBound( oFilterNames ) + fProps() = oFF.getByName(oFilterNames(i)) + For fp = LBound(fProps) To UBound(fProps) + oCell = oSheet.getCellByPosition(fp, i+1) + oProp = fProps(fp) + fpCol = FindInArrayAdd(oProp.Name, sPropNames) + If fpCol > UBound(sPropNames) Then + ReDim Preserve sPropNames(fpCol) As String + sPropNames(fpCol) = oProp.Name + End If + oCell = oSheet.getCellByPosition(fpCol, i+1) + If Not IsArray(oProp.Value) Then + oCell.setString(oProp.Value) + If oProp.Name = "Flags" Then + flags = oProp.Value + oCell.setString(CStr(flags) & " = " & flags_int2str(flags)) + If flags and 1 Then + oCell = oSheet.getCellByPosition(FindInArrayAdd("Import", sPropNames), i+1) + oCell.setString("X") + Endif + If flags and 2 Then + oCell = oSheet.getCellByPosition(FindInArrayAdd("Export", sPropNames), i+1) + oCell.setString("X") + Endif + If flags and 128 Then + oCell = oSheet.getCellByPosition(FindInArrayAdd("Options", sPropNames), i+1) + oCell.setString("X") + Endif + If ((flags and 4096) or (flags and 8192)) Then + oCell = oSheet.getCellByPosition(FindInArrayAdd("Visible", sPropNames), i+1) + oCell.setString("X") + Endif + End If + ElseIf LBound(oProp.Value) <= UBound(oProp.Value) Then + s = "" + oArrayData = oProp.Value + For iUserData = LBound(oArrayData) To UBound(oArrayData) + If VarType(oArrayData(iUserData)) = 8 Then + s = s & "(String:" & oArrayData(iUserData) & ")" + Else + s = s & "(" & oArrayData(iUserData).Name & ":" & oArrayData(iUserData).Value & ")" + End If + Next + oCell.setString(s) + End If + Next + Next + For fp = LBound(sPropNames) To Ubound(sPropNames) + oCell = oSheet.getCellByPosition(fp, 0) + oCell.setString(sPropnames(fp)) + Next + FinalFormat(oDoc) +End Sub +function flags_int2str(flags as long) as string +Dim cflags as long +Dim strval as string +Dim curFlag As Long +cflags = flags +strval = "" +if cflags and &H00000001 then +strval = strval + " Import" +cflags = cflags-1 +endif +if cflags and &H00000002 then +strval = strval + " Export" +cflags = cflags-2 +endif +if cflags and &H00000004 then +strval = strval + " Template" +cflags = cflags-4 +endif +if cflags and &H00000008 then +strval = strval + " Internal" +cflags = cflags-8 +endif + + if cflags and &H00000010 then +strval = strval + " TemplatePath" +cflags = cflags-16 +endif +if cflags and &H00000020 then +strval = strval + " Own" +cflags = cflags-32 +endif +if cflags and &H00000040 then +strval = strval + " Alien" +cflags = cflags-64 +endif +if cflags and &H00000080 then +strval = strval + " UseOptions" +cflags = cflags-128 +endif +if cflags and &H00000100 then +strval = strval + " Default" +cflags = cflags-256 +endif +if cflags and &H00000200 then +strval = strval + " Executable" +cflags = cflags-512 +endif +if cflags and &H00000400 then +strval = strval + " SupportSelection" +cflags = cflags-1024 +endif +if cflags and &H00000800 then +strval = strval + " MapToAppPlug" +cflags = cflags-2048 +endif +if cflags and &H00001000 then +strval = strval + " NotInFileDialog" +cflags = cflags-4096 +endif +if cflags and &H00002000 then +strval = strval + " NotInChooser" +cflags = cflags-8192 +endif +if cflags and &H00004000 then +strval = strval + " Acynchronas" +cflags = cflags-16384 +endif +if cflags and &H00008000 then +strval = strval + " Creator" +cflags = cflags-32768 +endif +if cflags and &H00010000 then +strval = strval + " Readonly" +cflags = cflags-65536 +endif +if cflags and &H00020000 then + + strval = strval + " NotInstalled" +cflags = cflags-131072 +endif +if cflags and &H00040000 then +strval = strval + " ConsultService" +cflags = cflags-262144 +endif +if cflags and &H00080000 then +strval = strval + " 3rdPartyFilter" +cflags = cflags-524288 +endif +if cflags and &H00100000 then +strval = strval + " Packed" +cflags = cflags-1048576 +endif +if cflags and &H00200000 then +strval = strval + " SilentExport" +cflags = cflags-2097152 +endif +if cflags and &H00400000 then +strval = strval + " BrowserPreferred" +cflags = cflags-4194304 +endif +if cflags and &H00800000 then +strval = strval + " [H00800000]" +cflags = cflags-8388608 +endif +if cflags and &H01000000 then +strval = strval + " [H01000000]" +cflags = cflags-16777216 +endif +if cflags and &H02000000 then +strval = strval + " [H02000000]" +cflags = cflags-33554432 +endif +if cflags and &H10000000 then +strval = strval + " Preferred" +cflags = cflags-268435456 +endif +if cflags <> 0 then +strval = strval + " !!! ATTENTION: unsupported flag ["+cflags+"] detected !!!" +endif +flags_int2str = strval +end function +Function FindInArrayAdd(sName$, nameArray) As Integer +Dim i As Integer +For i = LBound(nameArray()) To UBound(nameArray()) + + 'Print nameArray(i) & " and " & sName +If nameArray(i) = sName Then +FindInArrayAdd = i +Exit Function +End If +Next +i = UBound(nameArray()) + 1 +FindInArrayAdd = i +End Function +sub FinalFormat(oDoc) +rem ---------------------------------------------------------------------- +rem define variables +Dim document as object +Dim dispatcher as object +rem ---------------------------------------------------------------------- +rem get access to the document +document = oDoc.CurrentController.Frame +dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") +rem ---------------------------------------------------------------------- +Dim args1(0) as new com.sun.star.beans.PropertyValue +args1(0).Name = "ToPoint" +args1(0).Value = "$A$1" +dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1()) +rem ---------------------------------------------------------------------- +Dim args2(1) as new com.sun.star.beans.PropertyValue +args2(0).Name = "By" +args2(0).Value = 1 +args2(1).Name = "Sel" +args2(1).Value = true +dispatcher.executeDispatch(document, ".uno:GoRightToEndOfData", "", 0, args2()) +rem ---------------------------------------------------------------------- +Dim args3(2) as new com.sun.star.beans.PropertyValue +args3(0).Name = "FontHeight.Height" +args3(0).Value = 12 +args3(1).Name = "FontHeight.Prop" +args3(1).Value = 100 +args3(2).Name = "FontHeight.Diff" +args3(2).Value = 0 +dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args3()) +rem ---------------------------------------------------------------------- +Dim args4(0) as new com.sun.star.beans.PropertyValue +args4(0).Name = "Bold" +args4(0).Value = true +dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args4()) + +rem ---------------------------------------------------------------------- +Dim args5(0) as new com.sun.star.beans.PropertyValue +args5(0).Name = "HorizontalAlignment" +args5(0).Value = com.sun.star.table.CellHoriJustify.CENTER +dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args5()) +rem ---------------------------------------------------------------------- +Dim args6(1) as new com.sun.star.beans.PropertyValue +args6(0).Name = "By" +args6(0).Value = 1 +args6(1).Name = "Sel" +args6(1).Value = true +dispatcher.executeDispatch(document, ".uno:GoDownToEndOfData", "", 0, args6()) +rem ---------------------------------------------------------------------- +Dim args7(0) as new com.sun.star.beans.PropertyValue +args7(0).Name = "aExtraWidth" +args7(0).Value = 254 +dispatcher.executeDispatch(document, ".uno:SetOptimalColumnWidth", "", 0, args7()) +rem ---------------------------------------------------------------------- +Dim args8(8) as new com.sun.star.beans.PropertyValue +args8(0).Name = "ByRows" +args8(0).Value = true +args8(1).Name = "HasHeader" +args8(1).Value = true +args8(2).Name = "CaseSensitive" +args8(2).Value = false +args8(3).Name = "IncludeAttribs" +args8(3).Value = true +args8(4).Name = "UserDefIndex" +args8(4).Value = 0 +args8(5).Name = "Col1" +args8(5).Value = 7 +args8(6).Name = "Ascending1" +args8(6).Value = true +args8(7).Name = "Col2" +args8(7).Value = 1 +args8(8).Name = "Ascending2" +args8(8).Value = true +dispatcher.executeDispatch(document, ".uno:DataSort", "", 0, args8()) +dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1()) +end sub +
diff --git a/Basic/Standard/Sondage.bas b/Basic/Standard/Sondage.bas @@ -0,0 +1,822 @@ +REM ***** BASIC ***** +Option Explicit + +Const FieldOperationLimit = 10 + +Type SondageOperation + OpName as String + OpLocation as String +End Type + +Type SondageStatement + Cond as Integer + Operand as String + OpIds() as Integer +End Type + +Type SondageField + Field as String + ImportFormat as Integer + Width as Long + Statements() as SondageStatement + Values() as String +End Type + +Type SondageReport + Title as String + Settings() as com.sun.star.PropertyValue + Fields() as SondageField +End Type + +Type SondageConfiguration + Reports() as SondageReport + Headers() as String +End Type + +' FIXME Remove the 100 hard limit later +Dim OperationTable(100) as SondageOperation +Dim OperationTableLen% + +Function ColorRow(ByRef oSheet as Object, oRanges as Variant, highlightColor as Variant) + Dim oRange + For oRange = LBound(oRanges) To UBound(oRanges) + oRange.CellBackColor = highlightColor + Next +End Function + +Function ColumnOperation(ByRef oSheet as Object, oRanges as Variant, highlightColor as Variant) + Dim oRange + For oRange = LBound(oRanges) To UBound(oRanges) + oRange.CellBackColor = highlightColor + Next +End Function + +Function ColorCell(ByRef oSheet as Object, oRanges as Variant, highlightColor as Variant) + Dim oRange + For oRange = LBound(oRanges) To UBound(oRanges) + oRange.CellBackColor = highlightColor + Next +End Function + +Function Delete(ByRef oSheet as Object, oRanges as Variant, sArgs() as String) + Dim oRange + For Each oRange In oRanges + oSheet.removeByIndex(oRange.RangeAddress.StartRow) + Next oRange +End Function + +Sub SondageRegisterFunction(macroLocation$, macroName$) + OperationTable(OperationTableLen).OpLocation = macroLocation + OperationTable(OperationTableLen).OpName = macroName + OperationTableLen = OperationTableLen + 1 +End Sub + +Function _ReadUntilEndOrCharacter(ByRef sCell$, startIndex%, expect$, ByRef endIndex as Variant) as String + Dim c$, i% + c = Left(sCell, startIndex) + + For i = startIndex To Len(sCell) + If c = expect Then + _ReadUntilEndOrCharacter = Mid(sCell, startIndex, i - startIndex - 1) + endIndex = i + Exit Function + End If + + If c = "\n" Or c = ";" Then + ErrorLocal$ = "Expected '" & expect & "' got '" & c & "'" + Exit Function + End If + c = Mid(sCell, i, 1) + Next + _ReadUntilEndOrCharacter = Mid(sCell, startIndex, i - startIndex) + endIndex = i - 1 +End Function + +Function _ReadUntilCharacters(ByRef sCell$, startIndex%, expects() as Variant, ByRef endIndex&) as String + Dim c$, expect$ + + For endIndex = startIndex To Len(sCell) + c = Mid(sCell, endIndex, 1) + For Each expect In expects + If c = expect Then + _ReadUntilCharacters = Mid(sCell, startIndex, endIndex - startIndex) + Exit Function + End If + If c = "\n" Or c = ";" Then + ErrorLocal$ = "Expected '" & expect & "' got '" & c & "'" + Exit Function + End If + Next + Next + ErrorLocal$ = "Expected '" & expect & "' but reached end of cell" +End Function + +Sub TestSub + Dim sCell$, colName$ + Dim iCell% + sCell = "${variable with space} " & CHR(34) & "quoted string" & CHR(34) + colName = _ReadUntilCharacters(sCell, 3, Array("}"), iCell) + Print colName + If ErrorLocal$ <> "" Then + Print "Some error occurred: " & ErrorLocal + Exit Sub + End If + colName = _ReadUntilCharacters(sCell, iCell +3 , Array(CHR(34)), iCell) + If ErrorLocal$ <> "" Then + Print "Some error occurred: " & ErrorLocal + Exit Sub + End If + Print colName + 'If ErrorLocal$ <> "" Then + ' Print "Some error occurred: " & ErrorLocal + ' Exit Sub + 'End If +End Sub + +Function FunctionCall(colName$, actions) + Dim action$ + For Each action in actions + Print colName & " acts on " & action + Next 'action +End Function + +Function TokenDriver(Optional sCell) + Dim sonVars: sonVars = SondageReadSettings() + Dim si%: si = 1 + Dim tok$ + Dim tokType$ 'mode + If IsMissing(sCell) Then sCell = "${OrgCode}_Portln then @Area(.BadStyle @SomeOther Sort-ASCENDING)" + sCell = SondageExpandVariables(sCell, sonVars) + + Dim sCellLen: sCellLen = Len(sCell) + tok = GetToken(sCell, si, tokType) + While tok <> "" + Select Case tokType + Case "@" + Print "Some column types: "& tok + Case "(" + Print "Open Bracket: " & tok + Dim fi%: fi = 1 + Dim ftok$, ftokType$ + ftok = GetToken(tok, fi, ftokType) + While ftok <> "" + Print ftok + ftok = GetToken(tok, fi, ftokType) + Wend + Case "m" + Print "mode" + End Select + tok = GetToken(sCell, si, tokType) + Wend +End Function + +Function GetToken(sCell$, ByRef si%, ByRef m$) as String + Dim sonVars: sonVars = SondageReadSettings() + Dim sonState: SondageStatement: sonState = new SondageStatement + sCell = SondageExpandVariables(sCell, sonVars) + Dim sCellLen: sCellLen = Len(sCell) + Dim c$ 'current char + Dim endIndex& + Dim extract$ + Dim func$ + + For si = si To sCellLen + c = Mid(sCell, si, 1) + If c = "(" Then + extract = _ReadUntilCharacters(sCell, si + 1, Array(")"), endIndex) + si = endIndex + m = "(" + GetToken = extract + ElseIf c = "@" Or c = "." Then + m = c + If si + 1 < sCellLen Then + si = si + 1 + c = Mid(sCell, si, 1) + If c = "{" Then + extract = _ReadUntilCharacter(sCell, si + 1, "}", endIndex) + Else + extract = _ReadUntilCharacters(sCell, si, Array(" ", "(", ""), endIndex) + EndIf + If ErrorLocal$ <> "" Or endIndex > sCellLen Then + Print ErrorLocal$ + Exit Function + End If + If m = "@" Then 'Column mode + Print "Column is '" & extract & "'" + ElseIf m = "." Then + Print "Style is '" & extract & "'" + Else + Print "Probably a function: " & extract + End If + si = endIndex + GetToken = extract + Exit Function + End If + Else + m = "" + End If + Next 'si +End Function + +Function SondageGetOpId(macroName$) as Integer + Dim i% + SondageGetOpId = -1 + For i = 0 To OperationTableLen + If OperationTable(i).OpName = macroName Then + SondageGetOpId = i + Exit Function + End If + Next +End Function + +Function SondageValidateDoc(oDoc as Object, docType$) as String + Dim _err$ : _err = "" + If Not oDoc.supportsService(docType) Then + _err = oDoc.Title & " is not a valid Spreadsheet Document" + ElseIf oDoc.CurrentController.ViewControllerName = "PrintPreview" Then + _err = "Cannot run this macro in 'Print Preview', please close it and try again" + End If + SondageValidateDoc = _err +End Function + +Sub SondageCall(opId%, oSheet, Ranges) + Dim sonOp as SondageOperation: sonOp = OperationTable(opId) + Dim script + script=ThisComponent.scriptProvider.getScript("vnd.sun.star.script:" & sonOp.OpLocation & "." & sonOp.OpName & "?language=Basic&location=document") + script.invoke(Array(oSheet, Ranges), Array(), Array()) +End Sub + +Function SondageInferDocumentType(sonReports, aInputFiles as Variant) as SondageReport + Dim sonReport as SondageReport + Dim aMatch, used() as Boolean + Dim iMatch%, iInputFile%, matched as Boolean, allMatched as Boolean + + For Each sonReport In sonReports + Dim sMatch$: sMatch = SondageGetPropVal(sonReport.Settings, "Match") + If sMatch <> "" Then + aMatch = Split(sMatch, ";") + If UBound(aMatch) = UBound(aInputFiles) Then + ReDim used(UBound(aInputFiles)) + allMatched = True + For iMatch = 0 To UBound(aMatch) + matched = False + For iInputFile = 0 To UBound(aInputFiles) + If Not used(iInputFile) And Trim(aMatch(iMatch)) <> "" Then + If InStr(LCase(aInputFiles(iInputFile)), LCase(Trim(aMatch(iMatch)))) > 0 Then + used(iInputFile) = True + matched = True + Exit For + End If + End If + Next iInputFile + If Not matched Then + allMatched = False + Exit For + End If + Next iMatch + If allMatched Then + SondageInferDocumentType = sonReport + Exit Function + End If + End If + End If + Next sonReport +End Function + +Function SondageImportFiles(sondageReport as SondageReport, aInputFile as Variant, sDocType$, returnAlreadyOpenDoc as Boolean, Optional isHidden as Boolean) as Variant + Dim oDocs(0) as Variant + Dim iInputFile%, sInputFile$ + ReDim oDocs(0 To UBound(aInputFile)) as Variant + + For iInputFile = 0 To UBound(aInputFile) + sInputFile = aInputFile(iInputFile) + oDocs(iInputFile) = SondageImportFile(sondageReport, sInputFile, sDocType, returnAlreadyOpenDoc, isHidden) + If ErrorLocal$ <> "" Then Exit Function + Next iInputFile + SondageImportFiles = oDocs +End Function + +Function SondageCSVHeader(sLine$) as Variant + Dim fields() as String, value$, i&, n&, c$ + Dim quoted as Boolean + ReDim fields(0) + For i = 1 To Len(sLine) + c = Mid(sLine, i, 1) + If c = """" Then + If quoted And Mid(sLine, i + 1, 1) = """" Then + value = value & c + i = i + 1 + Else + quoted = Not quoted + End If + ElseIf c = "," And Not quoted Then + fields(n) = value + value = "" + n = n + 1 + ReDim Preserve fields(n) + Else + value = value & c + End If + Next i + fields(n) = value + SondageCSVHeader = fields +End Function + +Function SondageImportOptions(sondageReport as SondageReport, sInputFile$, Optional importAll as Boolean) as String + Dim firstRow%, fileNum%, i%, j%, formatCode% + Dim header$, headers, fieldName$, options$ + Dim reportField as SondageField + Dim onlyConfigured as Boolean + onlyConfigured = Not importAll And UCase(SondageGetPropVal(sondageReport.Settings, "ImportOnlyConfiguredFields")) <> "FALSE" + firstRow = 1 + Select Case sondageReport.Title + Case "INSPECTION", "TUBE", "CONSUMERS", "REFILL": firstRow = 4 + End Select + Dim configuredRow$: configuredRow = SondageGetPropVal(sondageReport.Settings, "ImportStartRow") + If configuredRow <> "" Then firstRow = CInt(configuredRow) + If firstRow < 1 Then + ErrorLocal$ = "ImportStartRow must be at least 1" + Exit Function + End If + fileNum = FreeFile + Open sInputFile For Input As #fileNum + For i = 1 To firstRow + Line Input #fileNum, header + Next i + Close #fileNum + headers = SondageCSVHeader(header) + options = "44,34,76," & firstRow & "," + For i = LBound(headers) To UBound(headers) + fieldName = UserFriendlyName(headers(i)) + formatCode = 1 ' Calc automatic selection when explicitly opted out + If onlyConfigured Then formatCode = 9 ' Ignore unlisted CSV fields + For j = LBound(sondageReport.Fields) To UBound(sondageReport.Fields) + reportField = sondageReport.Fields(j) + If reportField.Field = fieldName Then + formatCode = 1 ' Listed field without a type: automatic selection + If reportField.ImportFormat <> 0 Then formatCode = reportField.ImportFormat + Exit For + End If + Next j + If i > LBound(headers) Then options = options & "/" + options = options & (i + 1) & "/" & formatCode + Next i + SondageImportOptions = options +End Function + +Function SondageImportFile(sondageReport as SondageReport, sInputFile$, sDocType$, returnAlreadyOpenDoc as Boolean, Optional isHidden as Boolean, Optional importAll as Boolean) as Variant + Dim oDoc + Dim fileUrl + Dim p(3) as new com.sun.star.beans.PropertyValue + If IsMissing(isHidden) Then isHidden = True + + If returnAlreadyOpenDoc Then + oDoc = ReturnComponentIfOpen(sInputFile) + If Not IsNull(oDoc) Then + If Not oDoc.isReadonly() Then + SondageImportFile = oDoc + Exit Function + End If + End If + End If + + p(0).Name = "FilterName" + p(0).Value = CSV_FILTER_NAME + p(1).Name = "Hidden" + p(1).Value = isHidden + p(2).Name = "FilterOptions" + ' CSV sources may be open read-only; work in a writable, unnamed copy. + p(3).Name = "AsTemplate" + p(3).Value = True + fileUrl = ConvertToUrl(sInputFile) + If Not FileExists(fileUrl) Then + ErrorLocal = "Cannot open file '" & fileUrl & "'" + Exit Function + End If + p(2).Value = SondageImportOptions(sondageReport, sInputFile, importAll) + oDoc = StarDesktop.loadComponentFromURL(fileUrl, "_blank", 0, p()) + ' We may check if imported the correct file, by checking the number of columns + 'If oDoc.Sheets(0).Columns.Count = 2 Then + ' MsgBox "Single column psv" + 'End If + + if IsEmpty(oDoc)Then + ErrorLocal = "Failed to get Document for " & sInputFile + Exit Function + End If + + ErrorLocal = SondageValidateDoc(oDoc, sDocType) + If ErrorLocal <> "" Then + Exit Function + End If + SondageImportFile = oDoc +End Function + +Sub SondageGenerateReport(sondageReport, oDoc) + Print sondageReport.Title +End Sub + +Function SondageReadSettings() as Variant + Dim oDoc + Dim oSheet + Dim rangeAddress + Dim oRange + Dim iCell%, sKey$, sVal$ + Dim sonVars: sonVars = new Collection + + oSheet = ThisComponent.Sheets.getByName("Settings") + If IsNull(oSheet) Then + ErrorLocal$ = "Cannot find 'Settings' sheet" + Exit Function + End If + oRange = UsedRangeCursor(oSheet)'.RangeAddress + rangeAddress = oRange.RangeAddress + + For iCell = rangeAddress.StartRow To rangeAddress.EndRow + sKey = oRange.getCellByPosition(0, iCell).String + If sKey <> "" Then + sVal = oRange.getCellByPosition(1, iCell).String + sonVars.Add(item := sVal, key := sKey) + End If + Next 'iCell + SondageReadSettings = sonVars +End Function + +Sub SondageMain() + Dim sonReports() as Variant + Dim sonFields() as Variant + Dim sonReport, sonField, sonStatement + Dim iOpsLen%, iOp%, opId% + Dim sInputFile$: sInputFile = "C:\Users\bhara\Desktop\GetPendingOrderConsumerDetailsDateRange(36).csv" + Dim oDoc, oSheet, oUsedRange + + sonConf = SondageParseFieldConfiguration() + If ErrorLocal$ <> "" Then + MsgBox ErrorLocal$, 16 + Exit Sub + End If + + sonReports = sonConf.Reports + sonReport = SondageInferDocumentType(sonReports, sInputFile) + oDoc = SondageImportFile(sonReport, sInputFile, True, False) + + ' Copy the first, sheet if there is only one sheet in document + If oDoc.Sheets.Count = 1 Then + oDoc.Sheets.copyByName(oOrigSheet.Name, reportType & "WorkingCopy", 1) + End If + oSheet = oDoc.Sheets(1) + 'oSheet = oDoc.getSheets().getByIndex(0) + oUsedRange = UsedRangeCursor(oSheet) + If IsNull(oSheet) Then + MsgBox "Input file is null", 16 + Exit Sub + End If + + sonFields = sonReport.Fields + Dim str$ + + For Each sonField In sonFields + 'If Not IsEmpty(sonField) Then + str = sonReport.Title & ": Field Variables: " & sonField.Field & ", with width: " & sonField.Width & " with " & UBound(sonField.Statements) & " statements" + For Each sonStatement In sonField.Statements + iOpsLen = UBound(sonStatement.OpIds) + str = str & " has condition " & sonStatement.Cond & " for " & sonStatement.Operand & " " & "Operations: " & " " + Call SondageFilterColumn(oSheet, endColumn, endRow, "Area", orgCode & "_PortIn", sonStatement.Cond) + For iOp = 0 To iOpsLen + opId = sonStatement.OpIds(iOp) + str = str & opId + SondageCall(opId, oSheet, oRange) + Next + Print str + Next + Next +End Sub + +Sub SondageFilterColumns(oSheet) + Dim oFilterDesc + Dim filterRange, oRange + Dim oCursor, o, oColumnHeader, oDescriptor + Dim newColumn : newColumn = endColumn + 1 + Dim oFields(0) as new com.sun.star.sheet.TableFilterField + Dim filterCount as Long + Dim filterColumnName as String + Dim endRow& + Dim filterContent as Variant, filterOperator as Variant + + If IsMissing(filterOperator) Then filterOperator = com.sun.star.sheet.FilterOperator.EQUAL + Print filterOperator + + On Error Goto ErrorHandler + + oRange = oSheet.getCellRangeByPosition(newColumn, 0, newColumn, endRow) + oColumnHeader = oRange.getCellByPosition(0, 0) + oColumnHeader.setString("0") + + oDescriptor = oSheet.createReplaceDescriptor() + + filterRange = GetColumnRange(oSheet, endColumn, endRow, filterColumnName) + oFilterDesc = filterRange.createFilterDescriptor(True) + + With oFields(0) + .Field = filterRange.RangeAddress.StartColumn + .IsNumeric = IsNumeric(filterContent) + .Operator = filterOperator + .StringValue = filterContent + .NumericValue = filterContent + End With + + oFilterDesc.setFilterFields(oFields()) + oFilterDesc.ContainsHeader = True + oFilterDesc.UseRegularExpressions = False + oSheet.filter(oFilterDesc) + + ' TODO Check if there is a way to remove the 50,000 limit + oRange.fillSeries(com.sun.star.sheet.FillDirection.TO_BOTTOM, com.sun.star.sheet.FillMode.SIMPLE, 0, 1, 50000) + SortColumn(oSheet, 0, 1, newColumn, endRow, "0") + +ErrorHandler: + oSheet.filter(oSheet.createFilterDescriptor(True)) + oSheet.Columns.removeByIndex(newColumn, 1) + Reset +End Sub + +Function SondageExpandVariables(sCell$, sonVars as Variant, Optional varType$) as String + Dim sCellLen: sCellLen = Len(sCell) + Dim c$ + Dim si%, endIndex as Long + Dim extract$, varState as Boolean + + If IsMissing(varType) Then varType = "$" + + For si = 1 To sCellLen + c = Mid(sCell, si, 1) + If c = varType Then + varState = True + ElseIf varState = True Then + c = Mid(sCell, si, 1) + If c = "{" Then + extract = _ReadUntilCharacters(sCell, si + 1, Array("}"), endIndex) + Else + extract = _ReadUntilEndOrCharacter(sCell, si, " ", endIndex) + EndIf + If ErrorLocal$ <> "" Or endIndex > sCellLen Then + Print ErrorLocal$ + Exit Function + End If + SondageExpandVariables = SondageExpandVariables & sonVars.Item(extract) + si = endIndex + varState = False + Else + SondageExpandVariables = SondageExpandVariables & c + End If + Next 'si +End Function + +Function SondageGetCondTypeFromString(opCond$) as Integer + Dim condType% + condType = com.sun.star.sheet.ConditionOperator.EQUAL + SondageGetCondTypeFromString = condType + + If TypeName(opCond) <> "String" or Len(opCond) = 0Then + condType = com.sun.star.sheet.ConditionOperator.NONE + Exit Function + End If + + Select Case opCond + Case "<=" + condType = com.sun.star.sheet.ConditionOperator.LESS_EQUAL + Case ">=" + condType = com.sun.star.sheet.ConditionOperator.GREATER_EQUAL + Case "<>" + condType = com.sun.star.sheet.ConditionOperator.NOT_EQUAL + Case "><" + condType = com.sun.star.sheet.ConditionOperator.BETWEEN + Case "==" + condType = com.sun.star.sheet.ConditionOperator.EQUAL + Case Else + ' Check the first letter + Select Case Left(opCond, 1) + Case "<" + condType = com.sun.star.sheet.ConditionOperator.LESS + Case ">" + condType = com.sun.star.sheet.ConditionOperator.GREATER + Case "+" + condType = com.sun.star.sheet.ConditionOperator.FORMULA + End Select + End Select + SondageGetCondTypeFromString = condType +End Function + +Function _RemoveAllPrivateNamedRanges() + Dim aNamedRanges, sNamedRange, i% + aNamedRanges = ThisComponent.NamedRanges + For i = 0 To aNamedRanges.getCount() - 1 + sNamedRange = aNamedRanges.getByIndex(i).Name + If InStr(1, sNamedRange, "Sondage_", 0) = 1 Then ' sNamedRange starts with Sondage + aNamedRanges.removeByName(sNamedRange) + End If + Next i +End Function + +Function SondageParseFieldConfiguration() as SondageConfiguration + Dim reportNames, aValues + Dim oDoc, oSheet, oRange, oSearchRange + Dim startRow&, endRow&, endColumn&, iRow&, iCol& + Dim sCell, oCell + + ' Used for ReDim Statements and Fields + Dim sonConf as SondageConfiguration + Dim sonReports() as SondageReport + Dim sonStatements() as Variant + Dim sonFields() as Variant + Dim sonSettings() as Variant + Dim opIds() as Integer + + ' Remove OperationLimit later + Dim stTokens(200) as String + + Dim sonReport as new SondageReport + Dim sonField as new SondageField + Dim sonStatement as new SondageStatement + + Dim iWidth + Dim sStatements() as String, aHeaders() as String, sStatement$, sWidth$, opCond$ + Dim opTokens() as String + + SondageRegisterFunction("Standard.Sondage", "Select") + ' TODO Stub operation delete later + ' This is probably the modern verision of VLOOKUP that is based on column name + ' If something exists like this in Excel or Calc, just use its name + SondageRegisterFunction("Standard.Sondage", "ColumnOperation") + SondageRegisterFunction("Standard.Sondage", "ColorCell") + SondageRegisterFunction("Standard.Sondage", "ColorRow") + SondageRegisterFunction("Standard.Sondage", "Delete") + + oDoc = ThisComponent + oSheet = oDoc.getSheets().getByName("FieldConfiguration") + + oRange = UsedRangeCursor(oSheet) + startRow = 0 + endRow = oRange.RangeAddress.EndRow + endColumn = oRange.RangeAddress.EndColumn + + ReDim Preserve aHeaders(endColumn) as String + For iCol = 0 To endColumn + aHeaders(iCol) = oSheet.getCellByPosition(iCol, iRow).getString() + Next iCol + + For iRow = startRow To endRow + oCell = oSheet.getCellByPosition(0, iRow) + sCell = oCell.getText().String + If Left(sCell, 1) = "[" Then + ReDim Preserve sonReports(UBound(sonReports) + 1) as SondageReport + sonReport = sonReports(UBound(sonReports)) + sonReport.Fields = Array() + sonReport.Settings = Array() + ' TODO Restrict the Title to certain values + sonReport.Title = Mid(sCell, 2, Len(sCell) - 2) + oCell.CellStyle = "Heading1" + 'Print sonReport.Title + ElseIf Len(sonReport.Title) <> 0 Then + If Left(sCell, 1) = "@" Then + sonField = new SondageField + Dim fieldSpec$, typePos& + fieldSpec = Mid(sCell, 2) + typePos = InStr(fieldSpec, ":") + If typePos > 0 Then + sonField.Field = Left(fieldSpec, typePos - 1) + Select Case UCase(Mid(fieldSpec, typePos + 1)) + Case "TEXT": sonField.ImportFormat = 2 + Case "NUMBER", "AUTO": sonField.ImportFormat = 1 + Case "MM/DD/YY": sonField.ImportFormat = 3 + Case "DD/MM/YY": sonField.ImportFormat = 4 + Case "YY/MM/DD": sonField.ImportFormat = 5 + Case Else + ErrorLocal$ = "Unknown import type in " & sCell + Exit Function + End Select + Else + sonField.Field = fieldSpec + End If + + aValues = sonField.Values + ReDim aValues(endColumn) + For iCol = 0 To endColumn + aValues(iCol) = oSheet.getCellByPosition(iCol, iRow).getString() + Next iCol + sonField.Values = aValues + + sonField.Statements = Array() + sStatements = Split( _ + Trim(oSheet.getCellByPosition(1, iRow).getText().String), _ + CHR(13) _ + ) + sWidth = oSheet.getCellByPosition(2, iRow).getText().String + If sWidth = "0" Then + iWidth = 0 + ElseIf sWidth = "-1" or Len(sWidth) = 0 Then + ' Mark for deletion + iWidth = -1 + Else + iWidth = CLng(sWidth) + End If + sonField.Width = iWidth + For Each sStatement In sStatements + Dim ci: ci = 0 + Dim c$, pc$ + + For ci = 1 To Len(sStatement) + c = Mid(sStatement, ci, 1) + If c = "$" Then + ' Read the rest of the word and store in a variable + ' This variable should be replaced with content from a collection above + ' Essentially implementing a variable like function + End If + Next + stTokens = Split(sStatement, " then ") + sonStatement = new SondageStatement + + Dim stToken + Dim opToken$ + + If UBound(stTokens) = 0 Then + ' Operand Only + sonStatement.Operand = Trim(stTokens(0)) + 'Print sonReport.Title & "Operand Only: " & stTokens(0) + opTokens = Array() + ElseIf UBound(stTokens) > 0 Then + ' Cond then Op + opCond = Left(stTokens(0), 2) + + sonStatement.Cond = SondageGetCondTypeFromString(opCond) + + If sonStatement.Cond = com.sun.star.sheet.ConditionOperator.EQUAL Then + sonStatement.Operand = Trim(stTokens(0)) + Else + sonStatement.Operand = Trim(Right(stTokens(0), Len(stTokens(0)) - 2) ) + End If + End If 'UBound(stTokens) + + ' After Reading the condition, save the operation after finding the Id + If UBound(stTokens) > 0 Then + opTokens = Split(stTokens(1), ",") + For Each opToken In opTokens + Dim opPureTokens() as String + Dim opPureToken$ + Dim sonOpId%: sonOpId = -1 + opPureTokens = Split(Trim(opToken), "(") + If UBound(opPureTokens) = -1 Then + ErrorLocal$ = "FATAL: Error in row: " & iRow & ", Operation is malformed" + Exit Function + End If + opPureToken = Trim(opPureTokens(0)) + If Left(opPureToken, 1) = "@" Then + Print "This is a @ column thing: " & opPureToken + ' TODO Construct optoken and id and push the instructions to list + ' FIXME This does not do much now + sonOpId = SondageGetOpId("ColumnOperation") + Else + sonOpId = SondageGetOpId(opPureToken) + End If + If sonOpId = -1 Then + ErrorLocal$ = "FATAL: Cannot retrieve the operation " & opPureToken & " in row " & iRow + Exit Function + End If + opIds = sonStatement.OpIds + ReDim Preserve opIds(UBound(sonStatement.OpIds) + 1) as Integer + sonStatement.OpIds = opIds + sonStatement.OpIds(UBound(sonStatement.OpIds)) = sonOpId + Next 'opToken + Else + opTokens = Array(0) + End If + + sonStatements = sonField.Statements + ReDim Preserve sonStatements(UBound(sonField.Statements) + 1) as Variant + sonField.Statements = sonStatements + sonField.Statements(UBound(sonField.Statements)) = sonStatement + Next 'sOp + + sonFields = sonReport.Fields + ReDim Preserve sonFields(UBound(sonFields) + 1) as Variant + sonReport.Fields = sonFields + sonReport.Fields(UBound(sonReport.Fields)) = sonField + Else ' If != [ and != @ + sonSettings = sonReport.Settings + ReDim Preserve sonSettings(UBound(sonSettings) + 1) as Variant + sonSettings(UBound(sonSettings)) = CreateObject("com.sun.star.beans.PropertyValue") + sonSettings(UBound(sonSettings)).Name = sCell + sonSettings(UBound(sonSettings)).Value = oSheet.getCellByPosition(1, iRow).getText().String + oCell.CellStyle = "Card" + sonReport.Settings = sonSettings + End If + Else + MsgBox "Syntax Error: should start with [HEADER] element", 16 + Exit Function + End If + Next 'iRow + sonConf.Reports = sonReports + sonConf.Headers = aHeaders + SondageParseFieldConfiguration = sonConf +End Function +
diff --git a/Basic/Standard/script-lb.xml b/Basic/Standard/script-lb.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:library PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "library.dtd"> +<library:library xmlns:library="http://openoffice.org/2000/library" library:name="Standard" library:readonly="false" library:passwordprotected="false"> + <library:element library:name="HandyTools"/> + <library:element library:name="GVTAdvance"/> + <library:element library:name="CylinderAutomation"/> + <library:element library:name="Scrap"/> + <library:element library:name="AdGenerate"/> + <library:element library:name="BrochureGenerate"/> + <library:element library:name="Sondage"/> +</library:library>+ \ No newline at end of file
diff --git a/Basic/script-lc.xml b/Basic/script-lc.xml @@ -0,0 +1,5 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE library:libraries PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "libraries.dtd"> +<library:libraries xmlns:library="http://openoffice.org/2000/library" xmlns:xlink="http://www.w3.org/1999/xlink"> + <library:library library:name="Standard" library:link="false"/> +</library:libraries>+ \ No newline at end of file
diff --git a/CylinderAutomation.bas b/CylinderAutomation.bas @@ -1,1171 +0,0 @@ -'Copyright 2023-2025 Bharatvaj Hemanth <bharatvaj@yahoo.com> - -'Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -'1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -'2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following -'disclaimer in the documentation and/or other materials provided with the distribution. - -'3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote -'products derived from this software without specific prior written permission. - -'THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND -'ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -'WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -'DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -'FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -'DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -'SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -'AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -'(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -'SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -'Option VBASupport 1 -Option Explicit - -Type SondageSettings - oFieldAliasesRange as Variant -End Type - -Type SondageContext - oDoc as Variant - oSheet as Variant - oRange as Variant - headerRow& - startColumn& - startRow& - endColumn& - endRow& -End Type - -Private GlobalSondageSettings as New SondageSettings - -' Options read from sheet - -Private orgCode As String -Private exportPrefix As String -' Allowed values, -' EKYC, PENDING, INSPECTION, SBC, POPULATE -'The number of columns that are copied and the column size will be affected -Private reportType As String -Private inputType As String -'Holds filter information such as ONLINE -Private reportFilter As String -' The days below 'thorgCodee maximum date in report' to show as bad -Private priorityThreshold As Integer -Private highlightColor As Long -Private priorityColor As Long -Private isHeadless As Boolean -Private isDBRequired as Boolean -' True if you want to create sheets with Area specific data -Private enableGroupReports As Boolean -Private organizeInputsFolder as String -Private removeInputFileAfterSuccess as Boolean -Private gvtSoftwareFolder$ -Private debugInputFile$ -Private customerDBFile$ -Private shouldSyncWithGVT as Boolean -Private ErrorLocal$ -Private pendingRemarksValidateList$ -Private ekycRemarksList$ - -Private stateName As String -Private cityName As String - -Global Const highlightBasedOn = "Payment Option" ' A yellow background is drawn that matches this column and 'highlightSearchString' -Global Const highlightSearchString = "Online" ' Does partial match -Global Const highlightRemoveColumn = True ' True if you want remove the column once the highlight is done -Global Const shouldRunSubtotals = True -Global Const shouldExportPDF = True ' If True this will export all the created sheets with Area specific data individually TODO change name to easily understand -Global Const shouldExportSummaryEditable = True ' If True this will export summary editable -'Private shouldExportSummaryPDF as Boolean' If True the first page will be exported as PDF -Global Const shouldCreateDataPivot = False -Global Const CURRENCY_UNIT = "" - -Global Const CSV_FILTER_NAME = "Text - txt - csv (StarCalc)" - -' Refer https://help.libreoffice.org/latest/en-US/text/shared/guide/csv_params.html -Global Const PENDING_CSV_FILTER_OPTIONS = "44,34,76,1,5/9/6/4/7/1/8/9/9/9/10/9" -Global Const PENDING_PSV_FILTER_OPTIONS = "124,34,76,1,5/9/6/4/7/1/8/9/9/9/10/9" -Global Const INSPECTION_CSV_FILTER_OPTIONS = "44,34,76,4,1/9/7/9/8/9/9/9" -Global Const INSPECTION_PSV_FILTER_OPTIONS = "124,34,76,4,1/9/7/9/8/9/9/9" -Global Const TUBE_CSV_FILTER_OPTIONS = "44,34,76,4,1/9/7/9/9/9/10/9" -Global Const CONSUMERS_CSV_FILTER_OPTIONS = "44,34,76,4,1/9/2/1/3/2/4/9/5/9/6/9/7/9/8/9/9/9/10/9/11/9/12/9/13/9/14/1/15/9/16/2/17/9/18/9/19/9/20/9/21/9/22/9/23/9/24/9/25/9/26/9/27/9/28/9/29/9/30/9/31/9/32/2/33/1/34/1/35/9/36/9/37/9/38/9/39/1/40/1/41/9/42/9/43/9/44/3/45/9/46/9/47/9/48/9/49/9/50/9/51/9" -Global Const REFILL_CSV_FILTER_OPTIONS = "44,34,76,4,1/9/2/1/3/9/4/9/5/1/6/1/7/3/8/9/9/9/10/9/11/2/12/9/13/2/14/9/15/2/16/1" -Global Const NCTC_CSV_FILTER_OPTIONS = "44,34,76,1,1/1/2/9/3/9/4/1/5/1/6/9/7/9/8/9/9/9/10/1/11/1/12/9" -' Values are loaded from the document -' Move all these to SondageContext? Which contain sheet, {start,end}{Column,Row} and others common things -Private tillDate As Date -Private tillDateStr As String -Private fromDate As Date -Private fromDateStr As String -Private sheetNameSuffix As String -Private exportDestDir As String - -Sub CleanupProductCode(oSheet as Object, endColumn as Long, endRow as Long) - MsgBox "Not implemented: productNames" -End Sub - -Sub IterateTableAndAct() - ' Call it Sub-table in Sondage - ' Segregate Sondage as sondage-basic, sondage-db, etc? - Dim oDoc, oSheet, oCell - Dim iRow&, startColumn% - Dim oCursor As Object - Dim oTableRange As Object - Dim nLastRow As Long - Dim nRow As Long - Dim tableCount As Integer - - oDoc = ReturnComponentIfOpen("C:\Users\bhara\Downloads\ViewTransactionDetail.csv") - If IsNull(oDoc) Then - Print "Error opening Transaction Details" - Exit Sub - End If - oSheet = oDoc.getSheets().getByIndex(0) - - ' 1. Find the final used row on the entire sheet to know when to stop looping - oCursor = oSheet.createCursor() - oCursor.gotoEndOfUsedArea(False) - nLastRow = oCursor.RangeAddress.EndRow - - tableCount = 0 - nRow = 0 - - ' 2. Loop down Column A to find individual tables - Do While nRow <= nLastRow - oCell = oSheet.getCellByPosition(0, nRow) - - If oCell.Type <> com.sun.star.table.CellContentType.EMPTY Then - tableCount = tableCount + 1 - oCursor = oSheet.createCursorByRange(oCell) - oCursor.collapseToCurrentRegion() - oTableRange = oCursor.RangeAddress - - 'MsgBox "Found Table " & tableCount & " at Range: " & oTableRange.StartRow - - Dim oCurrentCell, sCurrentCell - oCurrentCell = oSheet.getCellByPosition(oTableRange.startColumn, oTableRange.startRow) - sCurrentCell = oCurrentCell.getString() - If InStr(sCurrentCell, "ConsumerNumber") Then - Act1(oSheet, oTableRange) - End If - - nRow = oCursor.RangeAddress.EndRow + 1 - Else - ' Move to the next row if this one is empty - nRow = nRow + 1 - End If - Loop - - MsgBox "Finished! Total tables found: " & tableCount -End Sub - -Function SondageContextSetRange(ByRef ctx as SondageContext, oRangeAddr, Optional hasHeader as Boolean) - If IsMissing(hasHeader) Then hasHeader = True - ctx.headerRow = oRangeAddr.StartRow - ctx.startColumn = oRangeAddr.startColumn - ctx.startRow = IIf(hasHeader, oRangeAddr.StartRow + 1, oRangeAddr.StartRow) - ctx.endColumn = oRangeAddr.endColumn - ctx.endRow = oRangeAddr.endRow -End Function - -Function Act1(oSheet, oRangeAddr) - Dim ctx as SondageContext - Dim iRow& - Dim iMainColumn% - ctx.oSheet = oSheet - SondageContextSetRange(ctx, oRangeAddr) - ' TODO Make this more flexible with regex, so this can - ' be set easily in the sheet - iMainColumn = GetHeaderPosition(ctx, "ConsumerNumber", True) - - If iMainColumn = -1 Then Exit Function - For iRow = ctx.startRow To ctx.endRow - Print ctx.oSheet.getCellByPosition(iMainColumn, iRow).getString() - Next iRow -End Function - -Function CreatePivotForRefill(ByRef ctx as SondageContext, ByRef sonConf as SondageConfiguration, oDestSheet) - Dim oTables, oTDescriptor, oFields, oField, iField% - Dim oCellAddress as new com.sun.star.table.CellAddress - - oCellAddress.Sheet = oDestSheet - oCellAddress.Column = 0 - oCellAddress.Row = 0 - - oTables = ctx.oSheet.getDataPilotTables() - oTDescriptor = oTables.createDataPilotDescriptor() - oTDescriptor.setSourceRange(ctx.oRange.getRangeAddress()) - - oFields = oTDescriptor.getDataPilotFields() - - iField = GetHeaderPosition("Operator Name") - oField = oFields.getByIndex(iField) - oField.Orientation = com.sun.star.sheet.DataPilotFieldOrientation.ROW - - iField = GetHeaderPosition("Type") - oField = oFields.getByIndex(iField) - oField.Orientation = com.sun.star.sheet.DataPilotFieldOrientation.COLUMN - - iField = GetHeaderPosition("Cylinder Qty") - oField = oFields.getByIndex(iField) - oField.Orientation = com.sun.star.sheet.DataPilotFieldOrientation.DATA - oField.Function = com.sun.star.sheet.GeneralFunction.SUM - - oTables.insertNewByName("REFILLDataPilot", oCellAddress, OTDescriptor) -End Function - -Function ReadSettings() as Boolean - Dim oDoc - Dim oSheet - Dim rangeAddress - Dim oRange - ReadSettings = False - - oSheet = ThisComponent.Sheets.getByName("Settings") - rangeAddress = UsedRangeCursor(oSheet).RangeAddress - oRange = oSheet.getCellRangeByPosition(0, 0, rangeAddress.EndColumn, rangeAddress.EndRow) - - isHeadless = True - ' Organization Details - orgCode = GetValueForKey(oRange, "OrgCode").String - stateName = GetValueForKey(oRange, "StateName").String - cityName = GetValueForKey(oRange, "CityName").String - highlightColor = GetValueForKey(oRange, "HighlightColor").CellBackColor - reportType = GetValueForKey(oRange, "ReportType").String - reportFilter = GetValueForKey(oRange, "ReportFilter").String - exportPrefix = GetValueForKey(oRange, "ExportFolder").String - priorityThreshold = CInt(GetValueForKey(oRange, "PriorityThreshold").String) - priorityColor = GetValueForKey(oRange, "PriorityColor").CellBackColor - enableGroupReports = CBool(GetValueForKey(oRange, "EnableGroupReports").String) - organizeInputsFolder = GetValueForKey(oRange, "OrganizeInputsFolder").String - removeInputFileAfterSuccess = CBool(GetValueForKey(oRange, "RemoveInputFileAfterSuccess").String) - gvtSoftwareFolder = GetValueForKey(oRange, "GVTSoftwareFolder").String - debugInputFile = GetValueForKey(oRange, "DebugInputFile").String - customerDBFile = GetValueForKey(oRange, "CustomerDBFile").String - shouldSyncWithGVT = GetValueForKey(oRange, "ShouldSyncWithGVT").String - pendingRemarksValidateList = GetValueForKey(oRange, "PendingRemarksValidateList").String - ekycRemarksList = GetValueForKey(oRange, "EkycRemarksList").String - ' Skip check if the path is not given - If shouldSyncWithGVT Then - If Not FileExists(gvtSoftwareFolder) Then - MsgBox "Please enter correct one and rerun the macro", 16, "Given GVT Advance Path does not exist" - Exit Function - End If - End If - - 'If IsNull(oCell) Then - ' MsgBox "Setting not found, throw error" - ' Exit Sub - 'End If - ReadSettings = True -End Function - -Function CreateValidationList(ctx as SondageContext, columnName$, sValidationList) - Dim oValidation, oRange, oCell - Dim aItems, sFirstItem$,finalFormula$ - oRange = GetColumnRange(ctx, columnName) - - Dim listDelim: listDelim = CHR(10) - - oValidation = oRange.Validation - oValidation.Type = com.sun.star.sheet.ValidationType.LIST - aItems = Split(sValidationList, listDelim) - - If LBound(aItems) <> -1 Then - sFirstItem = aItems(LBound(aItems)) - Else - sFirstItem = sValidationList - End If - - oCell = oRange.getCellByPosition(0, 0) - oCell.setString(sFirstItem) - - oRange.fillSeries(com.sun.star.sheet.FillDirection.TO_BOTTOM, com.sun.star.sheet.FillMode.SIMPLE, 0, 0, ctx.endRow) - - finalFormula = """" & Join(Split(sValidationList, listDelim), """;""") & """" - oValidation.setFormula1(finalFormula) - oRange.Validation = oValidation -End Function - -Function ValidateDoc(oDoc as Object, docType$) as String - Dim _err$ : _err = "" - if IsEmpty(oDoc)Then - _err = "Failed to get Document for " & sInputFile - ElseIf Not oDoc.supportsService(docType) Then - _err = sInputFile & " is not a valid Spreadsheet Document" - ElseIf oDoc.CurrentController.ViewControllerName = "PrintPreview" Then - _err = "Cannot run this macro in 'Print Preview', please close it and try again" - End If - ValidateDoc = _err -End Function - -Function AssertColumn(ctx as SondageContext, sCol$) as Boolean - Dim iCol% - AssertColumn = True - iCol = GetHeaderPosition(ctx, sCol) - If iCol = -1 Then - ErrorLocal$ = "Cannot proceed, " & sCol & " column is " & iCol - AssertColumn = False - End If -End Function - -Function SondageAppendColumn(ByRef ctx as SondageCtx, sColumnName$) - Dim oCell - Dim oRange - ctx.endColumn = ctx.endColumn + 1 - 'ctx.oSheet.getColumns().insertByIndex(ctx.endColumn, 1) - oCell = ctx.oSheet.getCellByPosition(ctx.endColumn, 0) - oCell.setString(sColumnName) - oRange = GetColumnRange(ctx, sColumnName) - oCell.CellStyle = "Heading 1" -End Function - -Function GetColumnSettings(sheetName$) as Boolean - Dim oDoc, oSheet - GetColumnSettings = False - oDoc = ThisComponent - oSheet = oDoc.getSheets().getByName(sheetName) - If IsNull(oSheet) Then Exit Function -End Function - -Function SondageGetContext(oSheet as Variant) as SondageContext - Dim ctx as New SondageContext - ctx.oSheet = oSheet - ctx.oDoc = oSheet.DrawPage.Forms.Parent - ctx.oRange = UsedRangeCursor(oSheet) - ctx.headerRow = 0 - ctx.startColumn = 0 - ctx.startRow = 1 - ctx.endRow = ctx.oRange.RangeAddress.EndRow - ctx.endColumn = ctx.oRange.RangeAddress.EndColumn - SondageGetContext = ctx -End Function - -Function SondageJoinVertical(ctx as SondageContext, sIdColumn$) - Dim i&: i = 1 - Dim iIdColumn%: iIdColumn = GetHeaderPosition(ctx, sIdColumn) - ' TODO Add mismatching content as array, rather than discarding them entirely - For i = ctx.startRow To ctx.endRow - With ctx.oSheet - If .getCellByPosition(iIdColumn, i).String = .getCellByPosition(iIdColumn, i + 1).String Then - .getRows().removeByIndex(i + 1, 1) - ctx.endRow = ctx.endRow - 1 - End If - End With - Next -End Function - -Function RemoveRows(ByRef ctx as SondageContext, rowsToRemove&) - If rowsToRemove <> 0 Then - ctx.oSheet.getRows().removeByIndex(0, rowsToRemove + 1) - ' FIXME Check this calculation again, this could be reason, West Mambalam is - ' not appearing on the list sometimes - ctx.endRow = ctx.endRow - (rowsToRemove + 1) - End If -End Function - -Function SondageConditionalHorizontalCopy(ctx as SondageContext, sDstColumn$, sSrcColumn$) - iSrcColumn = GetHeaderPosition(ctx, sSrcColumn) - iDstColumn = GetHeaderPosition(ctx, sDstColumn) - - Dim i&: i = 1 - ' Remove duplicates, Move value from 'Phone' if "Mobile' has no value - For i = ctx.startRow To ctx.endRow - With ctx.oSheet - If .getCellByPosition(iDstColumn, i).Value = 0 Then - .getCellByPosition(iDstColumn, i).Value = .getCellByPosition(iSrcColumn, i).Value - End If - End With - Next i -End Function - -Function SondageInit(oDoc) - Dim oFieldAliasesSheet as Variant - oFieldAliasesSheet = oDoc.getSheets().getByName("FieldAliases") - - GlobalSondageSettings.oFieldAliasesRange = UsedRangeCursor(oFieldAliasesSheet) -End Function - -Function SondageGetPropVal(aContainer, sProp$, Optional sDefaultValue) as String - Dim oParent - On Error Goto ErrorHandler - For Each oParent In aContainer - If oParent.Name = sProp Then - SondageGetPropVal = oParent.Value - Exit Function - End If - Next oParent - ErrorHandler: - If Not IsMissing(sDefaultValue) then SondageGetPropVal = sDefaultValue -End Function - -Function SondageReflectionQuickAccess(aContainer, sProp$, oVal, Optional callByNameArg%) as Variant - Dim oParent - If IsMissing(callByNameArg) Then callByNameArg = 2 ' 2 = Get operation - On Error Goto ErrorHandler - For Each oParent In aContainer - Dim propertyValue - propertyValue = CallByName(oParent, sProp, callByNameArg) - If propertyValue = oVal Then - SondageReflectionQuickAccess = oParent - Exit Function - End If - Next oParent - ErrorHandler: -End Function - -Function GetHeaderIndex(aHeader, sProperty$) as Long - Dim i% - GetHeaderIndex = -1 - For i = LBound(aHeader) To UBound(aHeader) - If aHeader(i) = sProperty Then - GetHeaderIndex = i - Exit Function - End If - Next i -End Function - -Function SondageTransformSheet(ctx, sonConf, reportType, sWidthColumn$) - Dim i%, iWidthColumn%, sWidth$ - Dim sField$ - Dim aReports, oReport - - aReports = sonConf.Reports - oReport = SondageReflectionQuickAccess(aReports, "Title", reportType) - - ' TODO Throw error - If IsEmpty(sonConf) Then Exit Function - - iWidthColumn = GetHeaderIndex(sonConf.Headers, sWidthColumn) - - Dim aColumns2D(UBound(oReport.Fields), 1) - For i = 0 To UBound(oReport.Fields) - sField = oReport.Fields(i).Field - aColumns2D(i, 0) = oReport.Fields(i).Field - sWidth = oReport.Fields(i).Values(iWidthColumn) - If sWidth <> "" Then - aColumns2D(i, 1) = CLng(sWidth) - End If - Next i - SondageRestructureColumns(ctx, aColumns2D) -End Function - -Sub _SondageTransformSheet(ctx, reportType$) - Dim oDoc - 'TODO This should be set through GroupHeader logic - oDoc = ctx.oDoc - - If reportType = "PENDING" Then - ApplyTheme(oDoc, "millennium.ots") - RemoveColumnsExcept(ctx, Array( _ - "Area", _ - "Address", _ - "ID", _ - "Name", _ - "Mobile", _ - "Book", _ - "Payment Option", _ - "Code" _ - )) - - SetWidths(ctx, Array( _ - Array("Area", 0), _ - Array("ID", 0), _ - Array("Code", 1000), _ - Array("Name", 7000), _ - Array("Mobile", 0), _ - Array("Book", 0) _ - )) - ElseIf reportType = "INSPECTION" Then - ApplyTheme(oDoc, "green_grapes.ots") - RemoveColumnsExcept(ctx, Array( _ - "Area", _ - "ID", _ - "Name", _ - "Address", _ - "Mobile" _ - )) - ElseIf reportType = "TUBE" Then - ApplyTheme(oDoc, "pumpkin.ots") - endColumn = RemoveColumnsExcept(ctx, Array( _ - "Area", _ - "ID", _ - "Name", _ - "Address", _ - "Mobile" _ - )) - ElseIf reportType = "REFILL" Then - ApplyTheme(oDoc, "pumpkin.ots") - RemoveColumnsExcept(ctx, Array( _ - "ID", _ - "Name", _ - "Code", _ - "Operator Name" _ - )) - '"Block Reason" _ - SetWidths(ctx, Array( _ - Array("ID", 0), _ - Array("Name", 3000), _ - Array("Code", 2000), _ - Array("Operator Name", 4000) _ - )) - ElseIf reportType = "DORMANT" Then - ApplyTheme(oDoc, "pumpkin.ots") - RemoveColumnsExcept(ctx, Array( _ - "Area", _ - "ID", _ - "Name", _ - "Address", _ - "Mobile" _ - )) - '"Block Reason" _ - SetWidths(ctx, Array( _ - Array("Area", 1000), _ - Array("ID", 0), _ - Array("Name", 3000), _ - Array("Address", 8000), _ - Array("Mobile", 2000) _ - )) - ElseIf reportType = "SBC"Then - ApplyTheme(oDoc, "pumpkin.ots") - RemoveColumnsExcept(ctx, Array( _ - "ID", _ - "Name", _ - "Address", _ - "Mobile", _ - "Area", _ - "No Of Cylinder" _ - )) - SetWidths(ctx, Array( _ - Array("ID", 0), _ - Array("Name", 3000), _ - Array("Address", 8000), _ - Array("Mobile", 0), _ - Array("Area", 0) _ - )) - ElseIf reportType = "EKYC" Then - ApplyTheme(oDoc, "nature.ots") - enableGroupReports = True - - RemoveColumnsExcept(ctx, Array( _ - "Area", _ - "ID", _ - "Name", _ - "Address", _ - "Mobile" _ - )) - SetWidths(ctx, Array( _ - Array("Area", 2000), _ - Array("ID", 0), _ - Array("Name", 3000), _ - Array("Address", 8500), _ - Array("Mobile", 2000) _ - )) - ElseIf reportType = "VIP" Then - ApplyTheme(oDoc, "green_grapes.ots") - RemoveColumnsExcept(ctx, Array( _ - "Area", _ - "ID", _ - "Name", _ - "Address", _ - "Mobile" _ - )) - SetWidths(ctx, Array( _ - Array("Area", 0), _ - Array("ID", 0), _ - Array("Name", 3000), _ - Array("Address", 8000), _ - Array("Mobile", 0) _ - )) - Else - ErrorLocal$ = "Unknown reportType: '" & reportType & "'" - Exit Sub - End If -End Sub - -Function SegregateEKYCDoneOnline() - ' Array -End Function - -Sub Main(Optional sInputFiles as Variant) - Dim aInputFiles, sInputFile$ - Dim aDoc as Variant, oDoc, oDBDoc, oDispatcher - Dim oOrigSheet, oSheet, oDBSheet, oSheets as Object - Dim oCursor, oTextCursor - Dim sonConf, sonReport, aSettings - - Dim sTheme$, badStyleName$ - Dim idColumn%, mobileColumn%, phoneColumn%, addressColumn%, nameColumn% - Dim groupByColumn%, areaNames as New Collection - Dim rowsToRemove% - Dim highlightedCount as Integer, formatNum as Integer - Dim idRange, bookRange, nameRange - Dim dColumns as Object - Dim headerRange as Object - Dim statusBar as Variant - Dim ctx as New SondageContext - Dim dbCtx as New SondageContext - Dim sGroupBy$, iGroupByColumn% - - Dim cellRangeToCopy as Object - Dim pageStyle as Object - Dim oLocale as new com.sun.star.lang.Locale - - ' Setup args - aInputFiles = Split(sInputFiles, ";") - - ' Initialize Globals - SondageInit(ThisComponent) - If Not ReadSettings() Then Exit Sub - ' TODO Move this to read settings? - sonConf = SondageParseFieldConfiguration() - - ' Casting to Long removes the time component - tillDate = CLng(Now()) - badStyleName = "T4" - enableGroupReports = True - - For Each sInputFile in aInputFiles - If IsMissing(sInputFile) Or TypeName(sInputFile) <> "String" Then - If debugInputFile <> "" Then - sInputFile = debugInputFile - isHeadless = False - Else - MsgBox "Please give an input file", 16, "No input given" - GoTo FinalFallback - End If - End If - Next sInputFile - - sInputFile = aInputFiles(0) - - sonReport = SondageInferDocumentType(sonConf.Reports, aInputFiles) - If IsEmpty(sonReport) Then - ErrorLocal = "Cannot infer report configuration for '" & sInputFile & "'" - Goto ErrorHandler - End If - inputType = sonReport.Title - - If reportType = "AUTO" Then - reportType = inputType - End If - - aSettings = sonReport.Settings - sGroupBy = SondageGetPropVal(aSettings, "GroupBy") - - 'If reportType = "PENDING" Then - ' isDBRequired = True - 'End If - - If isDBRequired Then - oDBDoc = SondageImportFile(sonReport, customerDBFile, "com.sun.star.sheet.SpreadsheetDocument", True, False) - If ErrorLocal$ <> "" Then Goto ErrorHandler - End If - - ' FIXME The isHidden = False value is hardcoded, but use value from settings - aDoc = SondageImportFiles(sonReport, aInputFiles, "com.sun.star.sheet.SpreadsheetDocument", True, False) - If ErrorLocal$ <> "" Then Goto ErrorHandler - oDoc = aDoc(0) - statusBar = oDoc.CurrentController.StatusIndicator - - If oDoc.CurrentController.hasFrozenPanes() Then - Call UnFreezeSelection(oDoc) - End If - - ctx = SondageGetContext(oDoc.Sheets(0)) - - If ctx.oSheet.IsProtected Then - ctx.oSheet.Unprotect(reportType) - End If - - ' NaiveLastTable gives us the last non-blank table's - ' TODO The name 'rowsToRemove' is misleading - rowsToRemove = NaiveLastTable(ctx) - RemoveRows(ctx, rowsToRemove) - - 'If oDoc.Sheets.Count <> 1 Then oDoc.Sheets.removeByName("CONSUMERSWorkingCopy") - - ' Copy the first, sheet if there is only one sheet in document - If oDoc.Sheets.Count = 1 Then - If shouldCreateDataPivot = False Then - oDoc.Sheets.copyByName(ctx.oSheet.Name, reportType & "WorkingCopy", 1) - End If - End If - - oDoc.lockControllers() - ' Register Styles - SetCustomBadStyle(oDoc, oLocale, badStyleName) : If ErrorLocal$ <> "" Then Goto ErrorHandler - - ctx.oSheet.Protect(reportType) - - If isDBRequired Then - dbCtx = SondageGetContext(oDBDoc.Sheets(0)) - Call CleanColumnHeaders(dbCtx) - End If - - ctx = SondageGetContext(oDoc.Sheets(1)) - - If ctx.oSheet.Name = reportType & "WorkingCopy" Then - ' It's not possible to create a style even if only one sheet is blocked - Call CleanColumnHeaders(ctx) - If GetHeaderPosition(ctx, sGroupBy) = -1 Then - ErrorLocal$ = "Cannot proceed, '" & sGroupBy & "' column not found" - Goto ErrorHandler - End If - End If - - ' FIXME Enable normal Consumer List Generation Later - If shouldSyncWithGVT Then - ReducedPopulateConsumerDetails(gvtSoftwareFolder, ctx.oSheet) - 'PopulateConsumerDetails(gvtSoftwareFolder, ctx.oSheet) - GoTo FinalFallback - End If - - 'Call CleanupProductCode(ctx, endRow) - - ' Filter - Remove unrequired fields - If reportType = "INSPECTION" Then - Call FilterColumn(ctx, "Area", orgCode & "_PortIn", com.sun.star.sheet.FilterOperator.NOT_EQUAL) - Call FilterColumn(ctx, "Inspection Due Now", "Over Due") - Call FilterColumn(ctx, "Mobile", 0, com.sun.star.sheet.FilterOperator.NOT_EQUAL) - ElseIf reportType = "TUBE" Then - Call FilterColumn(ctx, "Area", orgCode & "_PortIn", com.sun.star.sheet.FilterOperator.NOT_EQUAL) - Call FilterColumn(ctx, "Tube Change Due Now", "Over Due") - Call FilterColumn(ctx, "Mobile", 0, com.sun.star.sheet.FilterOperator.NOT_EQUAL) - ElseIf reportType = "VIP" Then - Call FilterColumn(ctx, "Category", "VIP") - ElseIf reportType = "DORMANT" Then - Call FilterColumn(ctx, "Block Reason", "Dormant") - ElseIf reportType = "REFILL" Then - Call FilterColumn(ctx, "Type", "Domestic", com.sun.star.sheet.FilterOperator.NOT_EQUAL) - End If - - ' Expensive Operation, run after filter - If inputType = "CONSUMERS" Then - ' TODO Sort will not lose it character after filter. This should be above filter - Call SortColumn(ctx, "ID") - SondageJoinVertical(ctx, "ID") - SondageConditionalHorizontalCopy(ctx, "Mobile", "Phone") - End If - - ' TODO Should this be automatic and obtained from ctx? - oCursor = UsedRangeCursor(ctx.oSheet) - - If reportType = "PENDING" Then - ' If the reportFilter is ONLINE, filter it, else highlight - ' TODO Add this feature to Sondage - If reportFilter = "ONLINE" Then - Call FilterColumn(ctx, "Payment Option", "Online Payment", com.sun.star.sheet.FilterOperator.EQUAL) - Else - highlightedCount = HighlightRowWithColumn(ctx, _ - "Payment Option", "Online Payment", RGB(255, 255, 0)) - End If - - ' Justify Leftmost cells to left and Rightmost cells to right - bookRange = GetColumnRange(ctx, "Book") - bookRange.setPropertyValue("HoriJustify", com.sun.star.table.CellHoriJustify.RIGHT) - - FormatRangeAsNumber(oLocale, oDoc.getNumberFormats(), bookRange, "DD/MM") - - tillDate = ComputeOnRange(ctx, "Book", com.sun.star.sheet.GeneralFunction.MAX) - fromDate = ComputeOnRange(ctx, "Book", com.sun.star.sheet.GeneralFunction.MIN) - - SetupConditionalForHighPriority(ctx.oDoc, oLocale, bookRange, badStyleName, "><", 1000, tillDate - priorityThreshold) - ElseIf reportType = "EKYC" Then - highlightedCount = HighlightRowWithColumn(ctx, _ - "Consumer Type", "PMUY", RGB(175, 255, 175)) - End If - - SondageTransformSheet(ctx, sonConf, reportType, "Group Width") - - If ErrorLocal$ <> "" Then Goto ErrorHandler - - If inputType = "PENDING" Then - if isDBRequired Then - If Not AssertColumn(dbCtx, "Address") Then GoTo ErrorHandler - End If - End If - - Call ShortenDirections(ctx, groupByColumn) - Call SortColumn(ctx, sGroupBy) - - If reportType = "PENDING" and isDBRequired Then - Call ColumnJoin(CHR(10), "ID", ctx, "Name", dbCtx, "Address") - End If - - sTheme = SondageGetPropVal(aSettings , "Theme") - If Not IsEmpty(sTheme) Then ApplyTheme(ctx.oDoc, sTheme) - - idRange = GetColumnRange(ctx, "ID") - idRange.setPropertyValue("HoriJustify", com.sun.star.table.CellHoriJustify.LEFT) - - ' Setup exportPrefix and sheetName - tillDateStr = Format(tillDate, "yyyy-mm-dd") - sheetNameSuffix = " - " & reportType & " " & tillDateStr - exportDestDir = tillDateStr & " " & reportType - - headerRange = ctx.oSheet.getCellRangeByPosition(0, 0, ctx.endColumn, 0) - headerRange.CellStyle = "Heading 1" - - pageStyle = ctx.oDoc.StyleFamilies.getByName("PageStyles").getByName("Default") - pageStyle.setPropertyValue("PrintGrid", True) - pageStyle.setPropertyValue("CenterHorizontally", True) - - pageStyle.HeaderIsOn = True - pageStyle.HeaderShared = True - pageStyle.FirstPageHeaderIsShared = True - - ' TODO simplify this logic, recalculate everytime - If highlightedCount <> 0 Then - If reportType = "PENDING" Then - Call SetHeader(pageStyle, Date() & " | FROM: " & fromDate, , "ONLINE: " & CStr(highlightedCount)) - ElseIf reportType ="EKYC" Then - Call SetHeader(pageStyle, "GENERATED ON: " & Date(), , "PMUY: " & CStr(highlightedCount)) - End If - End if - - pageStyle.setPropertyValue("LeftMargin", 0.2 * 2540) - pageStyle.setPropertyValue("RightMargin", 0.2 * 2540) - - ' Change original sheet name - ctx.oSheet.Name = "ALL" & sheetNameSuffix - - ' Clear subtotals if any before exporting area wise - If shouldRunSubtotals Then oCursor.removeSubtotals() - - If enableGroupReports Then - iGroupByColumn = GetHeaderPosition(ctx, sGroupBy) - If iGroupByColumn = -1 Then Goto ErrorHandler - If GenerateIndividualSheets(ctx, sonConf, reportType, sGroupBy, statusBar, False) = False Then - Goto ErrorHandler - End If - End If - - Dim summaryCtx as SondageContext: summaryCtx = ctx - summaryCtx.oSheet = oDoc.getSheets().getByIndex(1) - - Dim sValidationList$ - If reportType = "PENDING" Then - sValidationList = pendingRemarksValidateList - ElseIf reportType = "EKYC" Then - sValidationList = ekycRemarksList - End If - - If sValidationList <> "" Then - ' FIXME Add this check dynamically from config sheet - CreateValidationList(ctx, "Remarks", sValidationList) - End If - - If shouldRunSubtotals Then - Call RunSubtotals(oCursor, groupByColumn, statusBar) - Call ReArrangeResultToHeader(summaryCtx) - End If - - If statusBar Then statusBar.end() - - ' Export summary - If shouldExportPDF Then - ExportAs(oDoc, ctx.oSheet, exportPrefix, exportDestDir, "pdf") - End If - - if shouldExportSummaryEditable Then - ExportAs(oDoc, ctx.oSheet, exportPrefix, exportDestDir, "ods") - End If - - FinalFallback: - If Not IsEmpty(organizeInputsFolder) Then - If Not FileExists(organizeInputsFolder) Then MkDir(organizeInputsFolder) - - Dim sBackupInputFile: sBackupInputFile = organizeInputsFolder & GetPathSeparator() & tillDateStr & " " & reportType & ".csv" - If sBackupInputFile <> sInputFile Then - FileCopy(sInputFile, sBackupInputFile) - End If - End If - - If Environ("USERPROFILE") <> "" Then - ' Assume this is windows - Shell(Environ("COMSPEC"), 1, "/c start "" " & QS(QS(exportPrefix & GetPathSeparator() & exportDestDir))) - End If - If isHeadless Then - ' ThisComponent.Close(True) will close all open documents, we don't want that - ThisComponent.CurrentController.Frame.Close(True) - End If - - ErrorHandler: - If statusBar Then statusBar.end() - - ' This is the target document, so we close it everytime when not debugging - If Not IsNull(oDBDoc) and debugInputFile = False Then - oDoc.unlockControllers() - oDoc.Close(True) - End If - - ' Only close the DB file, when we are not debugging - If Not IsNull(oDBDoc) and debugInputFile = False Then - oDBDoc.unlockControllers() - oDBDoc.Close(True) - End If - - If ErrorLocal$ <> "" Then - MsgBox ErrorLocal$, 16, "FATAL Subfunction Error" - Exit Sub - End If - - If Erl <> 0 Then - MsgBox "Line " & Erl & ": "& Error$, 16, "FATAL Main Error" - On Error GoTo 0 - Exit Sub - End If - - If removeInputFileAfterSuccess Then - Kill(sInputFile) - End If -End Sub - -Function CopyRange(dstCtx as SondageContext, srcCtx as SondageContext, startRow&, endRow&) - ' Calculation for selecting the proper range - ' start end - '1 : endColumn 0 4 - 'groupByColumn + 1 : endColumn 2 4 - '0 : endColumn - 1 4 4 - - ' Copy Header - srcCtx.oSheet.copyRange(dstCtx.oSheet.getCellRangeByName("A1").CellAddress, _ - srcCtx.oSheet.getCellRangeByPosition( _ - srcCtx.startColumn, _ - 0, srcCtx.endColumn, 0).RangeAddress) - - ' Copy Contents - srcCtx.oSheet.copyRange(dstCtx.oSheet.getCellRangeByName("A2").CellAddress, _ - srcCtx.oSheet.getCellRangeByPosition(_ - srcCtx.startColumn, _ - startRow, _ - srcCtx.endColumn, _ - endRow).RangeAddress) -End Function - -Function GenerateIndividualSheets(ctx as SondageContext, sonConf as SondageConfiguration, reportType, sGroupByColumn$, statusBar as Variant, Optional sortColumn as Boolean) as Boolean - ' WARNING: This function requires a sorted column, unless specied as False in sortColumn - ' In that case, the column is assumed sorted - Dim oSheet as Variant, dstSheet as Variant - Dim startRow& - Dim d$, a$, sheetName$ - Dim iRow&, iGroupBy% - Dim subjectRange as Variant - Dim dstCtx as New SondageContext - GenerateIndividualSheets = False - - statusBar.start("Creating " & sGroupByColumn & " Wise", 100) - startRow = ctx.startRow - oSheet = ctx.oSheet - subjectRange = GetColumnRange(ctx, sGroupByColumn) - a = subjectRange.getCellByPosition(0, startRow).getString() - - ' FIXME We assume the groupBy will be at the start, this will change - iGroupBy = GetHeaderPosition(ctx, sGroupByColumn) - If iGroupBy > 0 And iGroupBy < ctx.endColumn Then - ErrorLocal$ = "Cannot have '" & sGroupByColumn & "' column in the middle" - Exit Function - End If - - ctx.startColumn = iGroupBy + 1 - - If IsMissing(sortColumn) Then sortColumn = True - For iRow = startRow To ctx.endRow - 1 - d = subjectRange.getCellByPosition(0, iRow).getString() - If a = "" And d = "" Then - Exit For - End If - - If a <> d Or iRow = (ctx.endRow - 1) Then - statusBar.setText("Generating report for " & d) - statusBar.setValue((iRow / ctx.endRow) * 100) - ' FIXME Get the columns automatically from the sheet - ' FIXME Covert the end column from endColumn above - - ' TODO maybe there is an elegant way than - ' writing this two times - sheetName = a & sheetNameSuffix - - ' Prepare Destination sheet - dstSheet = NewSheet(ctx.oDoc, sheetName) - dstCtx = SondageGetContext(dstSheet) - dstCtx.endRow = ctx.endRow - dstCtx.endColumn = ctx.endColumn - CopyRange(dstCtx, ctx, startRow, iRow) - - ' TODO Copy only required cells, instead of copying and deleting for GroupBys - Dim testAreaColumn: testAreaColumn = GetHeaderPosition(dstCtx, sGroupByColumn) - if testAreaColumn > 0 Then - dstSheet.getColumns().removeByIndex(testAreaColumn, 1) - End If - - SondageTransformSheet(dstCtx, sonConf, reportType, "Width") - - If shouldExportPDF Then - if ExportAs(dstCtx.oDoc, dstCtx.oSheet, exportPrefix, exportDestDir, "pdf") = False Then Exit Function - End If - startRow = (iRow + 1) - a = d - End If - Next iRow - GenerateIndividualSheets = True -End Function - -Function RunSubtotals(oCursor, iColumn, Optional statusBar as Variant) - If Not IsMissing(statusBar) Then statusBar.setText("Running subtotals") - Dim oSubtotalDesc : oSubtotalDesc = oCursor.createSubTotalDescriptor(true) - Dim oSubtotalColumn(0) as new com.sun.star.sheet.SubTotalColumn - - With oSubtotalColumn(0) - .Column = iColumn - .Function = com.sun.star.sheet.GeneralFunction.COUNT - End With - oSubtotalDesc.addNew(oSubtotalColumn, iColumn) - oCursor.applySubtotals(oSubtotalDesc, true) -End Function - -Sub SubstituteContent(oDoc, oShape, oProduct) - ' TODO Maybe change from If Not to If and show error? - If oShape.getName() = "" Then - Exit Sub - End If - If oShape.getName() = "StovePrice" Then - If oProduct.Price <> 0 Then - oShape.setString(CURRENCY_UNIT & CStr(oProduct.Price)) - End If - ElseIf oShape.getName() = "ProductBlurb" Then - If oProduct.Description <> "" Then - oShape.setString(oProduct.Description) - End If - ElseIf oShape.getName() = "ProductTitle" Then - If IsEmpty(oProduct.Title) Then - oShape.setString(oProduct.Title) - End If - End If -End Sub - -Function GetFirstOpenDocument(docType as String) - Dim oComponents: oComponents = StarDesktop.getComponents() - Dim oDoc - Dim oDocs: oDocs = oComponents.createEnumeration() - Do While oDocs.hasMoreElements() - oDoc = oDocs.nextElement() - If oDoc.supportsService(docType) Then - GetFirstOpenDocument = oDoc - Exit Function - End If - Loop -End Function - -Sub Dialog1Show - With GlobalScope.BasicLibraries - If Not .IsLibraryLoaded("Tools") Then .LoadLibrary("Tools") - End With - Dim oAddBtn - Dim oDialog1 - Dim oColorTbl, oHeaders, oColumn1, oColumn2, oColumn3, oComboBox, oDataModel - oDialog1 = Tools.ModuleControls.LoadDialog("Standard", "Dialog1") - oAddBtn = oDialog1.getControl("AddBtn").getModel() - oColorTbl = oDialog1.getControl("ColorTable").getModel() - oColorTbl.Width = 150 ' TODO get width value from column - - oColumn1 = createUnoService( "com.sun.star.awt.grid.GridColumn") - oColumn2 = createUnoService( "com.sun.star.awt.grid.GridColumn") - oColumn3 = createUnoService( "com.sun.star.awt.grid.GridColumn") - - oColumn1.Title = "Condition" - oColumn1.MaxWidth = 30 - oColumn2.Title = "Value" - oColumn2.MaxWidth = 30 - oColumn3.Title = "Color" - - ' Print oColumn3.dbg_properties() - oHeaders = createUnoService("com.sun.star.awt.grid.DefaultGridColumnModel") - oDataModel = createUnoService( "com.sun.star.awt.grid.DefaultGridDataModel") - - oHeaders.addColumn(oColumn1) - oHeaders.addColumn(oColumn2) - oHeaders.addColumn(oColumn3) - - oColorTbl.GridDataModel = oDataModel - - oColorTbl.ColumnModel = oHeaders - oDataModel.addRow("1", Array(">", "45", "#ff0000")) - oDialog1.Execute() -End Sub - -Sub SetCustomBadStyle(oDoc, oLocale, styleName as String) - Dim oCellStyles - Dim oStyle - Dim formatNum% - oCellStyles = oDoc.StyleFamilies("CellStyles") - If oCellStyles.hasByName(styleName) Then - oCellStyles.removeByName(styleName) - End If - oStyle = oDoc.createInstance("com.sun.star.style.CellStyle") - oCellStyles.insertByName(styleName, oStyle) - oStyle = oCellStyles.getByName(styleName) - oStyle.CellBackColor = RGB(255, 0, 0) - formatNum = GetNumberFormatNumber(oLocale, oDoc.getNumberFormats(), "DD/MM") - If formatNum = -1 Then - ErrorLocal$ = "WARNING: Cannot add '" & formatStr & "' as NumberFormat" - Exit Sub - End If - oStyle.NumberFormat = formatNum -End Sub - -Sub SetupConditionalForHighPriority(oDoc, oLocale, oRange, styleName$, _ - opCond$, formula1 as Variant, Optional formula2 as Variant) - - ' TODO Rework this function to automagically handle dates - Dim oConFormat - Dim oCondition(3) as new com.sun.star.beans.PropertyValue - - 'BasicLibraries.LoadLibrary("Sondage") - - ' FIXME This may very well crash on some operations, I have no idea, because - ' I have not tested it - If IsMissing(formula2) Then formula2 = "0" - - If TypeName(formula1) = "Date" Then - formula1 = CStr(CLng(formula1)) - End If - - If TypeName(formula2) = "Date" Then - formula2 = CStr(CLng(formula2)) - End If - - With oCondition(0) - .Name = "Operator" - .Value = SondageGetCondTypeFromString(opCond) - End With - With oCondition(1) - .Name = "Formula1" - .Value = formula1 - End With - With oCondition(2) - .Name = "Formula2" - .Value = formula2 - End With - With oCondition(3) - .Name = "StyleName" - .Value = styleName - End With - - oConFormat = oRange.ConditionalFormat - oConFormat.clear() - oConFormat.addNew(oCondition) - oRange.ConditionalFormat = oConFormat -End Sub - -Sub ShowFilterOptions() - Dim args(), i% - args() = StarDesktop.CurrentComponent.getArgs() - For i = 0 to uBound(Args()) - If args(i).Name = "FilterOptions" then inputbox args(i).Name,"",cStr(args(i).value) - Next -End Sub
diff --git a/HandyTools.bas b/HandyTools.bas @@ -1,1207 +0,0 @@ -REM ***** BASIC ***** -Option Explicit - -Type SondageSettings - oFieldAliasesRange as Variant -End Type - -Type SondageContext - oDoc as Variant - oSheet as Variant - oRange as Variant - headerRow& - startColumn& - startRow& - endColumn& - endRow& -End Type - -Private priceListPath as String - -Public Function Env(Value As Variant) As String - Env = Environ(Value) -End Function - -Type Product - Title as Variant ' com.sun.star.text.XText - Price as Integer - Description as String -End Type - -'https://ask.libreoffice.org/t/how-to-know-if-the-file-is-open/77760/7 -Function ReturnComponentIfOpen(Byval filePath As String) as Object - Dim oComp - filePath=ConvertToUrl(filePath) - For Each oComp In StarDesktop.Components - If HasUnoInterfaces(oComp, "com.sun.star.frame.XModel") Then ' component which has URL - If oComp.Url=filePath Then - ReturnComponentIfOpen = oComp - Exit Function - End If - End If - Next oComp -End Function - -Function CreateProperty(key as String, val as Variant) as com.sun.star.beans.PropertyValue - Dim oProp As New com.sun.star.beans.PropertyValue - oProp.Name = key - oProp.Value = val - CreateProperty = oProp -End Function - -Function GetHomePath() as Object - Dim oPathSub - oPathSub = CreateUnoService("com.sun.star.util.PathSubstitution") - GetHomePath = oPathSub.getSubstituteVariable("home") & "/" -End Function - -Function ReadProductFromSheet(oSheet as Object, sProductName as String) as Product - ' TODO FIX: Return the correct Product details instead of first item - Dim oProduct as Product - Dim iPrice - Dim oTitle - Dim iChannel as Integer - Dim oCalcDoc - Dim oCursor, oCell - Dim bProductFound: bProductFound = False - Dim i, j, iRow, iColumn as Integer - Dim sCalcFile: sCalcFile = ConvertToUrl(priceListPath) - - Dim oArgs(0) as new com.sun.star.beans.PropertyValue - oArgs(0).Name = "Hidden" - oArgs(0).Value = True - - oCursor = UsedRangeCursor(oSheet) - iRow = oCursor.getRows().Count() - iColumn = oCursor.getColumns().getCount() - - ' TODO Use Column headers for retrieving data - For i = 1 To iRow - 1 - oCell = oSheet.getCellByPosition(0, i) - If oCell.String = sProductName Then - bProductFound = True - Goto CLOSE_SHEET_AND_REFLECT: - End If - Next i - -CLOSE_SHEET_AND_REFLECT: - If bProductFound Then - oTitle = oSheet.getCellByPosition(1, i).getString() - oProduct.Title = oCursor - '############################ - oProduct.Price = oSheet.getCellByPosition(3, i).getValue() - End If - ReadProductFromSheet = oProduct - oCalcDoc.close(True) -End Function - -Function GetNumberFormatNumber(oLocale as com.sun.star.lang.Locale, ByRef oFormats, formatStr as String) as Integer - Dim formatNum as Long - GetNumberFormatNumber = -1 - formatNum = oFormats.queryKey(formatStr, oLocale, False) - ' add formatStr if it doesn't exist - If formatNum = -1 Then - formatNum = oFormats.addNew(formatStr, oLocale) - End If - GetNumberFormatNumber = formatNum -End Function - -Sub FormatRangeAsNumber(oLocale as com.sun.star.lang.Locale, ByRef oFormats, oRange, formatStr as String) - ' BASIC equivalent of 'Text to Columns' - Dim formatNum as Long, i as Integer - Dim oReplace - oReplace = oRange.createReplaceDescriptor() - - If oRange.getCellByPosition(0,0).getValue() = 0 Then - formatNum = GetNumberFormatNumber(oLocale, oFormats, formatStr) - If formatNum = -1 Then - ErrolLocal$ = "Cannot add " & formatStr & " as NumberFormat" - Exit Sub - End If - ' https://ask.libreoffice.org/t/macro-calc-convert-column-to-date-similar-text-to-columns/92168/20 - With oReplace - .searchString = ".+" - .replaceString = "&" - .SearchRegularExpression = True - End With - - oRange.NumberFormat = formatNum - oRange.replaceAll(oReplace) - End If -End Sub - -Function GetColumnRange(ctx as SondageContext, columnName as String, Optional shouldIncludeHeader as Boolean) as Object - Dim iHeaderPos - If IsMissing(shouldIncludeHeader) Then shouldIncludeHeader = False - iHeaderPos = GetHeaderPosition(ctx, columnName) - If iHeaderPos = -1 Then - GetColumnRange = ctx.oSheet.getCellRangeByPosition(0, 0, 0, 0) - Exit Function - End If - GetColumnRange = ctx.oSheet.getCellRangeByPosition(iHeaderPos, IIf(shouldIncludeHeader, ctx.headerRow, ctx.startRow), iHeaderPos, ctx.endRow) -End Function - -Function RemoveColumns(ctx as SondageContext, columnNames) as Long - Dim columnName as String - Dim iHeader as Integer - RemoveColumns = ctx.endColumn - For Each columnName in columnNames - iHeader = GetHeaderPosition(ctx, columnName) - If iHeader <> -1 Then - ctx.oSheet.getColumns().removeByIndex(iHeader, 1) - ctx.endColumn = ctx.endColumn - 1 - End If - Next - RemoveColumns = ctx.endColumn -End Function - -Function RemoveColumnsExcept(ctx as SondageContext, columnNames as Variant) as Long - Dim headerStr as String, columnName as String - Dim i% : i = 0 - Dim rI% : rI = 0 - Dim columnsToRemove(ctx.endColumn) as String - Dim headerRange, headerData - Dim found as Boolean : found = False - RemoveColumnsExcept = ctx.endColumn - - headerRange = ctx.oSheet.getCellRangeByPosition(0, 0, ctx.endColumn, 0) - headerData = headerRange.getFormulaArray() - - ' TODO Handle condition when columnNames does not have valid header - ' This causes an extra string element in the array - For i = 0 To UBound(headerData(0)) - headerStr = headerData(0)(i) - found = False - For Each columnName in columnNames - If headerStr = columnName Then - found = True - Exit For - End If - Next columnName - If Not found Then - columnsToRemove(rI) = headerStr - rI = rI + 1 - End If - Next i - - If i = 0 Then - Exit Function - End If - - If rI = 0 Then - RemoveColumnsExcept = ctx.endColumn - Exit Function - End If - ReDim Preserve columnsToRemove(rI - 1) - - RemoveColumnsExcept = RemoveColumns(ctx, columnsToRemove) -End Function - -Sub ApplyTheme(ByRef oDoc, sFileName As String) - Dim oFamilies - Dim aOptions(0) as New com.sun.star.beans.PropertyValue - Dim stylesDir() - Dim StylePath as String - GlobalScope.BasicLibraries.loadLibrary("Tools") - oFamilies = oDoc.StyleFamilies - StylesDir = GetOfficeSubPath("Template", "wizard/styles/") - StylePath = StylesDir & sFileName - aOptions(0).Name = "OverwriteStyles" - aOptions(0).Value = true - oFamilies.loadStylesFromURL(StylePath, aOptions()) -End Sub - -Function NaiveLastTable(ctx as SondageContext) as Long - ' Return the row position last table that is separated by an empty row - Dim oRows - Dim iRow as Long - Dim usedRange - NaiveLastTable = 0 - oRows = ctx.oRange.Rows - - For iRow = 0 To oRows.getCount() - 1 - If oRows.getByIndex(iRow).computeFunction(com.sun.star.sheet.GeneralFunction.COUNT) = 0Then - NaiveLastTable = iRow - End If - Next -End Function - -Function IsValidFileName(fileName as String) as Boolean - Dim invalidChars as String : invalidChars = "\/:*?""<>|" - Dim c as String - Dim i as Integer - IsValidFileName = False - For i = 1 To Len(fileName) - c = Mid(fileName, i, 1) - If InStr(invalidChars, c) > 0 Then - Print "Invalid character '" & c & "' found in '" & fileName & "'" - Exit Function - End If - Next - IsValidFileName = True -End Function - -Function ExportAs(oDoc, oSheet, exportPrefix$, exportDestDir$, exportExt$) as Boolean - Dim cursor as Object - Dim args(2) as New com.sun.star.beans.PropertyValue - Dim fd(2) as New com.sun.star.beans.PropertyValue - Dim fileName as String, fileUrl - ExportAs = False - On Error GoTo ErrorHandler - - If Not IsValidFileName(oSheet.Name) Then - ErrorLocal$ = "Sheet has invalid characters for file export" - Exit Function - End If - - 'If Right(exportPrefix, 1) = "/" Or Right(exportPrefix, 1) = "\" Then - ' exportPrefix = Left(exportPrefix, Len(exportPrefix) - 1) - - fileUrl = ConvertToUrl(exportPrefix) - If Not FileExists(fileUrl) Then - ErrorLocal$ = "FATAL: " & fileUrl & " does not exist" - Exit Function - End If - - fileUrl = ConvertToUrl(exportPrefix & GetPathSeparator() & exportDestDir) - If Not FileExists(fileUrl) Then - Mkdir fileUrl - End If - - fileName = exportPrefix & GetPathSeparator() & exportDestDir & GetPathSeparator() & oSheet.Name & "." & exportExt - fileUrl = ConvertToUrl(fileName) - - WIth fd(0) : .Name = "Selection" : .Value = UsedRangeCursor(oSheet) : End With - ' Disabled, because it conflicts with selection - With fd(1) : .Name = "SinglePageSheets" : .Value = False : End With - With fd(2) : .Name = "IsSkipEmptyPages" : .Value = True : End With - - If exportExt = "pdf" Then - With args(0) : .Name = "FilterName" : .Value = "calc_pdf_Export" : End With - ElseIf exportExt = "ods" Then - With args(0) : .Name = "FilterName" : .Value = "calc8" : End With - Else - ErrorLocal$ = "FATAL: Export type '" & exportExt & "' not handled" - End If - - With args(1) : .Name = "FilterData" : .Value = fd : End With - With args(2) : .Name = "Overwrite" : .Value = True : End With - - oDoc.storeToURL(fileUrl, args) - ExportAs = True - Exit Function -ErrorHandler: - ErrorLocal$ = "FATAL: ExportPDF: Unknown error" -End Function - -Sub ListOfActiveCustomers() - Dim oSheet, destSheet, cursor, oRange - Dim startRow as Long - Dim endRow as Long - Dim startColumn as Long - Dim endColumn as Long - Dim requiredFields() - Dim requiredFieldIndices() as Integer - Dim iColumn as Integer, iRequiredField as Integer - Dim headerCellStr as String - - oSheet = ThisComponent.Sheets(0) - cursor = UsedRangeCursor(oSheet) - - ' Skip Header - startRow = NaiveLastTable(cursor) - endRow = cursor.RangeAddress.EndRow - endColumn = cursor.RangeAddress.EndColumn - ' TODO Use data from PhoneNumber if some MobileNumber is missing - requiredFields = Array("ConsumerNumber", "ConsumerName", "MobileNumber", "AreaCodeDesc", "LastDelivDate") - 'oSheet.Rows.removeByIndex(0, 3) - - For iColumn = startColumn To endColumn - headerCellStr = oSheet.getCellByPosition(iColumn, startRow, iColumn, startRow).getString() - For iRequiredField = 0 To UBound(requiredFields) - If headerCellStr = requiredFields(iRequiredField) Then - ' TODO Allocate memory before hand and use a tracker index? - ReDim Preserve requiredFieldIndices(UBound(requiredFieldIndices) + 1) - requiredFieldIndices(UBound(requiredFieldIndices)) = iColumn - End If - Next iRequiredField - Next iColumn - destSheet = NewSheet(oDoc, "SBC Connection") - - Print Join(requiredFieldIndices) - - ' TODO Ignore the Header Table if it exists - ' i.e. If two tables exists, assume the first one to be header table - ' and ignore it while copying to new sheet - - ' Copy the cells in 'requiredFieldIndices' to 'destSheet' -End Sub - -Sub CombineFiles(sFolder as String, fileRegex as String) - Dim sFile - Dim sFiles as Variant - Dim i as Integer: i = 0 - Dim oDoc as Variant - Dim dstSheet - Dim oDstCursor - Dim oSrcCursor - Dim rangeAddress - Dim oSheet - If Not FileExists(sFolder) Then - ErrorLocal$ = "sFolder path: '" & sFolder & "' does not exist" - Exit Sub - End If - - sFile = Dir( sFolder & "\" & fileRegex, 0) - - If IsEmpty(oDoc) Then - oDoc = ImportReportFile(sFolder & "\" & sFile, False) - if IsEmpty(oDoc) Then - ErrorLocal$ = "Failed to get Document for " & sInputFile - Exit Sub - End If - If Not oDoc.supportsService( "com.sun.star.sheet.SpreadsheetDocument") Then - Print "The imported document is not a sheet document" - End If - dstSheet = oDoc.getSheets().getByIndex(0) - End If - - sFile = Dir() - Do While(sFile <> "") - oDstCursor = UsedRangeCursor(dstSheet) - i = i + 1 - - oDoc.getSheets().insertNewByName(CStr(i), i) - oSheet = oDoc.getSheets().getByIndex(i) - If IsEmpty(oSheet) Then - ErrorLocal$ = "Cannot create new sheet" - Exit Sub - End If - - oSheet.link(ConvertToUrl(sFolder & "\" & sFile), CStr(i), CSV_FILTER_NAME, PENDING_CSV_FILTER_OPTIONS, com.sun.star.sheet.SheetLinkMode.NORMAL) - - oSrcCursor = UsedRangeCursor(oSheet, 1) - - dstSheet.copyRange(dstSheet.getCellByPosition(0, oDstCursor.RangeAddress.EndRow + 1).getCellAddress(), oSrcCursor.RangeAddress) - sFile = Dir() - Loop -End Sub - -Function UsedRangeCursor(oSheet as Variant, Optional rowsToSkip as Integer) as Variant - Dim oCursor - Dim i as Integer - oCursor = oSheet.createCursor() - oCursor.gotoStartOfUsedArea(False) - If Not IsMissing(rowsToSkip) Then oCursor.gotoOffset(0, rowsToSkip, False) - oCursor.gotoEndOfUsedArea(True) - UsedRangeCursor = oCursor -End Function - -Function GetProductNames() as Variant - GetProductNames = Array( _ - 5300, "14.2", _ - 5350, "14.2s", _ - ) - ' TODO finish deploying the extension and push extension to git -End Function - -Function ProductDescrption(productCode as Integer) as String - Dim i as Long - Dim productNames: productNames = GetProductNames() - ProductDescription = "" - For i = 0 To UBound(productNames) Step 2 - If productNames(i) = productCode Then - ProductDescription = productNames(i + 1) - End If - Next i -End Function - -Function GetValueForKey(oRange as Variant, key as String, Optional valueOffset%) as Object - ' Returns a ScCellObj - Dim oSearchRange - Dim oSearchDescriptor - Dim oCell - - If oRange.Columns.Count < 2 Then - MsgBox "GetValueForKeyCannot have columns less than 2", 16 - GetValueForKey = oCell - Exit Function - End If - - oSearchRange = oRange.getCellRangeByPosition(0, 0, 0, oRange.Rows.Count - 1) - oSearchDescriptor = oSearchRange.createSearchDescriptor() - With oSearchDescriptor - .SearchString = key - .SearchWords = True - .SearchCaseSensitive = True - End With - oCell = oSearchRange.findFirst(oSearchDescriptor) - - If Not IsNull(oCell) Then - If IsMissing(valueOffset) Then - valueOffset = oCell.RangeAddress.StartColumn + 1 - End If - oCell = oRange.getCellByPosition( valueOffset, _ - oCell.RangeAddress.StartRow _ - ) - End If - GetValueForKey = oCell -End Function - -Function UserFriendlyName(str as String) as String - ' Checks headerName and headerNameMatches for the string 'str', - ' If it's not available there, a naïve implementation adds spacing to 'str' - Dim l as Long - Dim c as String - Dim i as Long - Dim prevChar$ - Dim oValCell - - str = Trim(str) - oValCell = GetValueForKey(GlobalSondageSettings.oFieldAliasesRange, str) - If Not IsNull(oValCell) Then - UserFriendlyName = oValCell.String - Exit Function - End If - - l = Len(str) - ' Check with header "database" - For i = 0 To l - c = Mid(str, i + 1, 1) - If i > 1 And (c > "A" And c < "Z") Then - ' Only prepend space if 'c' is not the first character... - ' or previous char doesn't have space - UserFriendlyName = UserFriendlyName & IIf(prevChar = " ", "", " ") & c - Else - UserFriendlyName = UserFriendlyName & c - End If - prevChar = c - Next -End Function - -Sub SortColumn(ctx as SondageContext, columnName1 as String, Optional columnName2 as String) - Dim iHeaderPos as Long - Dim oSortFields(1) as new com.sun.star.util.SortField - Dim oSortDesc(0) as new com.sun.star.beans.PropertyValue - - iHeaderPos = GetHeaderPosition(ctx, columnName1) - If iHeaderPos = -1 Then - Exit Sub - End If - - - ' Area - oSortFields(0).Field = iHeaderPos - oSortFields(0).SortAscending = True - - ' FIXME This should be handled from the sheet settings - If Not IsMissing(columnName2) Then - iHeaderPos = GetHeaderPosition(ctx, columnName2) - If iHeaderPos = -1 Then - Exit Sub - End If - oSortFields(1).Field = iHeaderPos - oSortFields(1).SortAscending = True - End If - - oSortDesc(0).Name = "SortFields" - oSortDesc(0).Value = oSortFields - - ctx.oRange.Sort(oSortDesc) -End Sub - -Function NewSheet(oDoc, sheetName as String) as Object - Dim sheets as Object - sheets = oDoc.Sheets() - If Not sheets.hasByName(sheetName) Then - sheets.insertNewByName(sheetName, sheets.getCount()) - End If - NewSheet = sheets.getByName(sheetName) -End Function - -Sub CleanColumnHeaders(ctx as SondageContext) - Dim cell as Object - Dim neatName as String - Dim i as Integer - For i = ctx.startColumn To ctx.endColumn - cell = ctx.oSheet.getCellByPosition(i, ctx.headerRow) - neatName = cell.getString() - neatName = UserFriendlyName(neatName) - cell.setString(neatName) - Next -End Sub - -Sub RemoveExtraMergeCells(oDoc as Object, oSheet as Object, oRangeAddress as Variant) - Dim oRange as Object - Dim oSortFields(0) as new com.sun.star.util.SortField - Dim oSortDesc(0) as new com.sun.star.beans.PropertyValue - Dim endRow as Long - - endRow = oRangeAddress.EndRow - lastColumn = oRangeAddress.EndColumn - - rem set the range on which to sort' - - 'oRange = oSheet.getCellRangeByName("A2:F20") - oRange = oSheet.getCellRangeByPosition(0, 0, lastColumn, 0) - oDoc.getCurrentController().select(oRange) - initialColumnCount = oRange.Columns.getCount() - 1 - deletedColumns = 0 - For j = 0 To (initialColumnCount - deletedColumns) - oCell = oRange.getCellByPosition(j, 0) - con = oCell.String - If con = "" Then - oRange.Columns.removeByIndex(j, 1) - deletedColumns = deletedColumns - 1 - Else - Print con - End If - Next -End Sub - -Sub UnFreezeSelection(oDoc as Object) - Dim dispatcher as Object - dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") - dispatcher.executeDispatch(oDoc.getCurrentController().getFrame(), ".uno:FreezePanes", "", 0, Array()) -End Sub - -Function GetHeaderPosition(ctx as SondageContext, searchString$, Optional isRoughHeaderMatch as Boolean) as Integer - Dim iColumn as Integer - Dim oCell as Object - Dim cellString as String - GetHeaderPosition = -1 - If IsMissing(isRoughHeaderMatch) Then isRoughHeaderMatch = False - If searchString = "" Then - Exit Function - End If - - For iColumn = ctx.startColumn To ctx.endColumn - oCell = ctx.oSheet.getCellByPosition(iColumn, ctx.headerRow) - cellString = oCell.String - If cellString = "" Then - 'ErrorLocal$ = "BAD ARGUMENT: Cannot have empty columns within UsedRange, endColumn is " & CStr(endColumn) - Exit Function - End If - - ' TODO Implement regex matching - If isRoughHeaderMatch = True Then - If InStr(cellString, searchString) Then - GetHeaderPosition = iColumn - Exit Function - End If - ElseIf cellString = searchString Then - GetHeaderPosition = iColumn - Exit Function - End If - Next iColumn -End Function - -Function HighlightRowWithColumn(ctx as SondageContext, _ - highlightColumnName, highlightValue, Optional highlightColor as Long) as Long - Dim currentStr as String - Dim oCell as Object - Dim oCellRange as Object - Dim str as String - Dim iSearchColumn as Long - Dim i as Integer - Dim highlightCount as Long - - If IsMissing(highlightColor) Then - highlightColor = RGB(255, 255, 0) - End If - - ' Search for column position that has highlightBasedOn - iSearchColumn = GetHeaderPosition(ctx, highlightColumnName) - If iSearchColumn = -1 Then Exit Function - For i = ctx.startRow To ctx.endRow - 1 - oCell = ctx.oSheet.getCellByPosition(iSearchColumn, i) - If oCell.getString() = highlightValue Then - oCellRange = ctx.oSheet.getCellRangeByPosition(0, i, ctx.endColumn, i) - oCellRange.CellBackColor = highlightColor - highlightCount = highlightCount + 1 - End If - Next i - HighlightRowWithColumn = highlightCount -End Function - -Function ComputeOnRange(ctx as SondageContext, columnName as String, computeFunc%) as Long - Dim headerPos - Dim column - Dim val - headerPos = GetHeaderPosition(ctx, columnName) - If headerPos = -1 Then - ErrorLocal$ = "Cannot find a column header that starts with '" & columnName & "'" - Exit Function - End If - ' TODO Check if the column we are searching, actually has date values. - column = ctx.oSheet.getCellRangeByPosition(headerPos, 1, headerPos, ctx.endRow) - ComputeOnRange = column.computeFunction(computeFunc) -End Function - -Sub ColumnJoin(joinChar$, idColumnName, dstCtx as SondageContext, dstColumnName$, srcCtx as SondageContext, srcColumnName$) - Dim i&, j& - Dim dstEndRow&, dstEndColumn%, srcEndRow&, srcEndColumn% - Dim dstColumnIdx%, srcColumnIdx% - Dim dstStr$, dstCell - Dim dstRange, srcRange, srcRangeAddress, dstRangeAddress - Dim oTextCursor, oService, statusBar - statusBar = ThisComponent.CurrentController.StatusIndicator - oService = CreateUNOService("com.sun.star.sheet.FunctionAccess") - - dstRange = UsedRangeCursor(dstCtx.oSheet) - dstRangeAddress = dstRange.RangeAddress - srcRange = UsedRangeCursor(srcCtx.oSheet) - srcRangeAddress = srcRange.RangeAddress - - dstEndRow = dstRangeAddress.EndRow - srcEndRow = srcRangeAddress.EndRow - - dstColumnIdx = GetHeaderPosition(dstCtx, dstColumnName) - srcColumnIdx = GetHeaderPosition(srcCtx, srcColumnName) - - - Dim srcColumnIdIdx: srcColumnIdIdx = GetHeaderPosition(srcCtx, idColumnName) - Dim newSrcRange - newSrcRange = srcSheet.getCellRangeByPosition(srcColumnIdIdx, srcCtx.startRow, srcCtx.endColumn, srcCtx.endRow) - - Dim dstColumnIdIdx: dstColumnIdIdx = GetHeaderPosition(dstCtx, idColumnName) - - statusBar.start("Merging Columns", 100) - For i = dstStartRow To dstEndRow - Dim srcCell - Dim srcStr$ - Dim what$ - - statusBar.setText("Merging " & CStr(i) & "/" & dstEndRow) - statusBar.setValue((i / dstEndRow) * 100) - - dstCell = dstRange.getCellByPosition(dstColumnIdx, i) - dstStr = dstCell.getText().String - what = dstRange.getCellByPosition(dstColumnIdIdx, i).getText().String - - srcStr = oService.callFunction("VLOOKUP", Array(what, newSrcRange, srcColumnIdx, True)) - - - dstCell.getText().setString(dstStr & joinChar & srcStr) - - oTextCursor = dstCell.getText().createTextCursor() - oTextCursor.gotoStart(False) - oTextCursor.goRight(Len(dstStr), True) - 'oTextCursor.CharWeight = com.sun.star.awt.FontWeight.BOLD - oTextCursor.goRight(1, False) - oTextCursor.gotoEnd(True) - oTextCursor.CharHeight = 7 - srcStr = "" - what = "" - Next - statusBar.end() -End Sub - -' TODO Use a general function that takes arrays -' and instead of the function ShortenDirections, use -' ReplaceArrays to make it more usable across other projects. -Sub ShortenDirections(ctx as SondageContext, columnIdx as Integer) - 'Shorten East as E. etc - Dim toReplace() as String - Dim toReplaceWith() as String - Dim i as Long - Dim oDescriptor - Dim oColumn - Dim columnToReplace - oColumn = ctx.oSheet.getColumns().getByIndex(columnIdx) - ' TODO arrange it with convention - toReplace() = Array("East", "West", "South", "North") - toReplaceWith() = Array("E.", "W.", "S.", "N.") - oDescriptor = oColumn.createReplaceDescriptor() - For i = LBound(toReplace) To UBound(toReplace) - With oDescriptor - .SearchString = toReplace(i) - .ReplaceString = toReplaceWIth(i) - End With - oColumn.replaceAll(oDescriptor) - Next i -End Sub - -Sub FilterColumn(ctx as SondageContext, filterColumnName as String, filterContent as Variant, Optional filterOperator as Variant, Optional filterUseRegex as Boolean) - Dim oFilterDesc - Dim filterRange, oRange - Dim oCursor, o, oDescriptor - 'Dim oColumnHeader - Dim newColumn : newColumn = ctx.endColumn + 1 - Dim oFields(0) as new com.sun.star.sheet.TableFilterField - Dim filterCount as Long - - If IsMissing(filterOperator) Then filterOperator = com.sun.star.sheet.FilterOperator.EQUAL - If IsMissing(filterUseRegex) Then filterUseRegex = False - - 'On Error Goto ErrorHandler - - oRange = ctx.oSheet.getCellRangeByPosition(newColumn, 0, newColumn, ctx.endRow) - 'oColumnHeader = oRange.getCellByPosition(0, 0) - 'oColumnHeader.setString("0") - - oDescriptor = ctx.oSheet.createReplaceDescriptor() - - filterRange = GetColumnRange(ctx, filterColumnName) - oFilterDesc = filterRange.createFilterDescriptor(True) - - With oFields(0) - .Field = filterRange.RangeAddress.StartColumn - .IsNumeric = IsNumeric(filterContent) - .Operator = filterOperator - .StringValue = filterContent - .NumericValue = filterContent - End With - - oFilterDesc.setFilterFields(oFields()) - oFilterDesc.ContainsHeader = True - oFilterDesc.UseRegularExpressions = filterUseRegex - ctx.oSheet.filter(oFilterDesc) - - ' TODO Check if there is a way to remove the 50,000 limit - 'oRange.fillSeries(com.sun.star.sheet.FillDirection.TO_BOTTOM, com.sun.star.sheet.FillMode.SIMPLE, 0, 1, 50000) - 'SortColumn(ctx.oSheet, 0, 1, newColumn, endRow, "0") - - 'filterCount = oRange.computeFunction(com.sun.star.sheet.GeneralFunction.COUNT) - 'ctx.oSheet.Rows.removeByIndex(filterCount, (ctx.endRow - filterCount) + 1) - -'ErrorHandler: - 'ctx.oSheet.filter(ctx.oSheet.createFilterDescriptor(True)) - 'ctx.oSheet.Columns.removeByIndex(newColumn, 1) - 'Reset -End Sub - -Sub SetHeader(ByRef oPageStyle, Optional sLeftHeader$, Optional sCenterHeader$, Optional sRightHeader) - Dim oHeader - Dim oText - Dim oTextCursor - - oHeader = oPageStyle.RightPageHeaderContent - - If Not IsMissing(sLeftHeader) Then - oText = oHeader.LeftText - oTextCursor = oText.createTextCursor() - oText.insertString(oTextCursor, sLeftHeader, true) - End If - - If Not IsMissing(sCenterHeader) Then - oText = oHeader.CenterText - oTextCursor = oText.createTextCursor() - oText.insertString(oTextCursor, sCenterHeader, true) - End If - - If Not IsMissing(sRightHeader) Then - oText = oHeader.RightText - oTextCursor = oText.createTextCursor() - oText.insertString(oTextCursor, sRightHeader, true) - End If - - oPageStyle.RightPageHeaderContent = oHeader -End Sub - -Sub SondageRestructureColumns(ctx as SondageContext, aColumnWidth as Variant) - ' columnWidthArray has values like Array(Array("Area", 0), Array("ID", 2000)) - ' 0 means autofill - Dim columnWidth, iField% - Dim sField$, iWidth as Variant - Dim oColumn - Dim iHeaderColumn - - For iField = LBound(aColumnWidth) To UBound(aColumnWidth) - sField = aColumnWidth(iField, 0) - iWidth = aColumnWidth(iField, 1) - - If Not IsEmpty(iWidth) Then - iHeaderColumn = GetHeaderPosition(ctx, sField) - If iHeaderColumn = -1 Then - If iWidth = -1 Then - ' No-Op as the field already does not exist - ElseIf iWidth >= 0 Then - SondageAppendColumn(ctx, sField) - iHeaderColumn = GetHeaderPosition(ctx, sField) - Else - ErrorLocal$ = "Cannot find: " & sField & " in headers": Exit Sub - End If - End If - - If iHeaderColumn <> -1 Then - oColumn = ctx.oSheet.getColumns().getByIndex(iHeaderColumn) - If iWidth = -1 Then - 'ctx.oSheet.getColumns().removeByIndex(iHeaderColumn, 1) - oColumn.IsVisible = False - 'ctx.endColumn = ctx.endColumn - 1 - Else - If iWidth = 0 Then - oColumn.OptimalWidth = True - Else - oColumn.Width = iWidth - End If - End if - End If - End If - Next iField - ErrorLocal$ = "" -End Sub - -Sub ReArrangeResultToHeader(ctx as SondageContext, Optional headerStyle$) - Dim startRow&, nRow&, nCol&, insertRow& - Dim oDoc, oRange, oUsedRangeAddress - Dim resultRanges - Dim oAddrs() - Dim oAddr - Dim oFound, oCells - Dim insertRowCell - Dim oSearchDesc - - If IsMissing(headerStyle) Then headerStyle = "Accent 1" - startRow = 1 - - oUsedRangeAddress = UsedRangeCursor(ctx.oSheet).RangeAddress - oRange = ctx.oSheet.getCellRangeByPosition(0, startRow, 0, oUsedRangeAddress.EndRow) - - oSearchDesc = oRange.createSearchDescriptor() - oSearchDesc.SearchStyles = True - oSearchDesc.SearchString = "Result" - - Dim sResult, sGroupBy - Dim oRows, oCols, emptyValue as Object - oRows = ctx.oSheet.getRows() - oCols = ctx.oSheet.getColumns() - Dim colRange - - ' Construct first row and column to be same as others - oRows.insertByIndex(startRow, 1) - insertRowCell = ctx.oSheet.getCellByPosition(0, startRow) - insertRowCell.CellStyle = "Result" - - oFound = ctx.oSheet.findFirst(oSearchDesc) - Do While Not IsNull (oFound) - 'Print "Name is: " & oFound.getText().getString() - insertRowCell = ctx.oSheet.getCellByPosition(1, startRow) - startRow = oFound.RangeAddress.StartRow - If startRow > oUsedRangeAddress.EndRow Then - oFound = emptyValue - Else - sResult = ctx.oSheet.getCellByPosition(0, startRow).getText().String - sGroupBy = ctx.oSheet.getCellByPosition(0, startRow - 1).getText().String - colRange = ctx.oSheet.getCellRangeByPosition(1, startRow, 5, startRow) - colRange.merge(True) - colRange.CellStyle = headerStyle - insertRowCell.getText().setString(sGroupBy & " (" & sResult & ")") - - oRange = ctx.oSheet.getCellRangeByPosition(0, startRow, 0, oUsedRangeAddress.EndRow) - oFound = ctx.oSheet.findNext(oRange, oSearchDesc) - End If - Loop - - oCols.removeByIndex(0, 1) -End Sub - - - - - - - - - - - - - - -sub FiltersToCalc - Dim oFF ' FilterFactory service - Dim oFilterNames ' Array of filter names. - Dim oDoc ' Document created to hold the filter names. - Dim oSheet ' Sheet that will hold the filter information. - Dim oCell ' Cell to update - - Dim i% ' Index Variable. - Dim fProps() ' Properties for each filter. - Dim fp% ' Filter property index - Dim fpCol% ' Column for the specified filter data. - Dim s$ ' Work string that holds some property values. - Dim iUserData% ' For enumerating array property values. - Dim oProp ' A single property. - Dim oArrayData ' Array of user properties. - Dim sPropNames(7) As String - Dim flags As Long - sPropNames(0) = "Name" - sPropNames(1) = "Import" - sPropNames(2) = "Export" - sPropNames(3) = "Options" - sPropNames(4) = "Visible" - sPropNames(5) = "Flags" - sPropNames(6) = "DocumentService" - sPropNames(7) = "UIName" - oFF = createUnoService( "com.sun.star.document.FilterFactory" ) - oFilterNames = oFF.getElementNames() - ' Create a Calc doc and save the filter names to it. - oDoc = StarDesktop.loadComponentFromURL( "private:factory/scalc", "_blank", 0, Array() ) - oSheet = oDoc.getSheets().getByIndex(0) - ' Print the filter names into a document. - For i = LBound( oFilterNames ) To UBound( oFilterNames ) - fProps() = oFF.getByName(oFilterNames(i)) - For fp = LBound(fProps) To UBound(fProps) - oCell = oSheet.getCellByPosition(fp, i+1) - oProp = fProps(fp) - fpCol = FindInArrayAdd(oProp.Name, sPropNames) - If fpCol > UBound(sPropNames) Then - ReDim Preserve sPropNames(fpCol) As String - sPropNames(fpCol) = oProp.Name - End If - oCell = oSheet.getCellByPosition(fpCol, i+1) - If Not IsArray(oProp.Value) Then - oCell.setString(oProp.Value) - If oProp.Name = "Flags" Then - flags = oProp.Value - oCell.setString(CStr(flags) & " = " & flags_int2str(flags)) - If flags and 1 Then - oCell = oSheet.getCellByPosition(FindInArrayAdd("Import", sPropNames), i+1) - oCell.setString("X") - Endif - If flags and 2 Then - oCell = oSheet.getCellByPosition(FindInArrayAdd("Export", sPropNames), i+1) - oCell.setString("X") - Endif - If flags and 128 Then - oCell = oSheet.getCellByPosition(FindInArrayAdd("Options", sPropNames), i+1) - oCell.setString("X") - Endif - If ((flags and 4096) or (flags and 8192)) Then - oCell = oSheet.getCellByPosition(FindInArrayAdd("Visible", sPropNames), i+1) - oCell.setString("X") - Endif - End If - ElseIf LBound(oProp.Value) <= UBound(oProp.Value) Then - s = "" - oArrayData = oProp.Value - For iUserData = LBound(oArrayData) To UBound(oArrayData) - If VarType(oArrayData(iUserData)) = 8 Then - s = s & "(String:" & oArrayData(iUserData) & ")" - Else - s = s & "(" & oArrayData(iUserData).Name & ":" & oArrayData(iUserData).Value & ")" - End If - Next - oCell.setString(s) - End If - Next - Next - For fp = LBound(sPropNames) To Ubound(sPropNames) - oCell = oSheet.getCellByPosition(fp, 0) - oCell.setString(sPropnames(fp)) - Next - FinalFormat(oDoc) -End Sub -function flags_int2str(flags as long) as string -Dim cflags as long -Dim strval as string -Dim curFlag As Long -cflags = flags -strval = "" -if cflags and &H00000001 then -strval = strval + " Import" -cflags = cflags-1 -endif -if cflags and &H00000002 then -strval = strval + " Export" -cflags = cflags-2 -endif -if cflags and &H00000004 then -strval = strval + " Template" -cflags = cflags-4 -endif -if cflags and &H00000008 then -strval = strval + " Internal" -cflags = cflags-8 -endif - - if cflags and &H00000010 then -strval = strval + " TemplatePath" -cflags = cflags-16 -endif -if cflags and &H00000020 then -strval = strval + " Own" -cflags = cflags-32 -endif -if cflags and &H00000040 then -strval = strval + " Alien" -cflags = cflags-64 -endif -if cflags and &H00000080 then -strval = strval + " UseOptions" -cflags = cflags-128 -endif -if cflags and &H00000100 then -strval = strval + " Default" -cflags = cflags-256 -endif -if cflags and &H00000200 then -strval = strval + " Executable" -cflags = cflags-512 -endif -if cflags and &H00000400 then -strval = strval + " SupportSelection" -cflags = cflags-1024 -endif -if cflags and &H00000800 then -strval = strval + " MapToAppPlug" -cflags = cflags-2048 -endif -if cflags and &H00001000 then -strval = strval + " NotInFileDialog" -cflags = cflags-4096 -endif -if cflags and &H00002000 then -strval = strval + " NotInChooser" -cflags = cflags-8192 -endif -if cflags and &H00004000 then -strval = strval + " Acynchronas" -cflags = cflags-16384 -endif -if cflags and &H00008000 then -strval = strval + " Creator" -cflags = cflags-32768 -endif -if cflags and &H00010000 then -strval = strval + " Readonly" -cflags = cflags-65536 -endif -if cflags and &H00020000 then - - strval = strval + " NotInstalled" -cflags = cflags-131072 -endif -if cflags and &H00040000 then -strval = strval + " ConsultService" -cflags = cflags-262144 -endif -if cflags and &H00080000 then -strval = strval + " 3rdPartyFilter" -cflags = cflags-524288 -endif -if cflags and &H00100000 then -strval = strval + " Packed" -cflags = cflags-1048576 -endif -if cflags and &H00200000 then -strval = strval + " SilentExport" -cflags = cflags-2097152 -endif -if cflags and &H00400000 then -strval = strval + " BrowserPreferred" -cflags = cflags-4194304 -endif -if cflags and &H00800000 then -strval = strval + " [H00800000]" -cflags = cflags-8388608 -endif -if cflags and &H01000000 then -strval = strval + " [H01000000]" -cflags = cflags-16777216 -endif -if cflags and &H02000000 then -strval = strval + " [H02000000]" -cflags = cflags-33554432 -endif -if cflags and &H10000000 then -strval = strval + " Preferred" -cflags = cflags-268435456 -endif -if cflags <> 0 then -strval = strval + " !!! ATTENTION: unsupported flag ["+cflags+"] detected !!!" -endif -flags_int2str = strval -end function -Function FindInArrayAdd(sName$, nameArray) As Integer -Dim i As Integer -For i = LBound(nameArray()) To UBound(nameArray()) - - 'Print nameArray(i) & " and " & sName -If nameArray(i) = sName Then -FindInArrayAdd = i -Exit Function -End If -Next -i = UBound(nameArray()) + 1 -FindInArrayAdd = i -End Function -sub FinalFormat(oDoc) -rem ---------------------------------------------------------------------- -rem define variables -Dim document as object -Dim dispatcher as object -rem ---------------------------------------------------------------------- -rem get access to the document -document = oDoc.CurrentController.Frame -dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") -rem ---------------------------------------------------------------------- -Dim args1(0) as new com.sun.star.beans.PropertyValue -args1(0).Name = "ToPoint" -args1(0).Value = "$A$1" -dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1()) -rem ---------------------------------------------------------------------- -Dim args2(1) as new com.sun.star.beans.PropertyValue -args2(0).Name = "By" -args2(0).Value = 1 -args2(1).Name = "Sel" -args2(1).Value = true -dispatcher.executeDispatch(document, ".uno:GoRightToEndOfData", "", 0, args2()) -rem ---------------------------------------------------------------------- -Dim args3(2) as new com.sun.star.beans.PropertyValue -args3(0).Name = "FontHeight.Height" -args3(0).Value = 12 -args3(1).Name = "FontHeight.Prop" -args3(1).Value = 100 -args3(2).Name = "FontHeight.Diff" -args3(2).Value = 0 -dispatcher.executeDispatch(document, ".uno:FontHeight", "", 0, args3()) -rem ---------------------------------------------------------------------- -Dim args4(0) as new com.sun.star.beans.PropertyValue -args4(0).Name = "Bold" -args4(0).Value = true -dispatcher.executeDispatch(document, ".uno:Bold", "", 0, args4()) - -rem ---------------------------------------------------------------------- -Dim args5(0) as new com.sun.star.beans.PropertyValue -args5(0).Name = "HorizontalAlignment" -args5(0).Value = com.sun.star.table.CellHoriJustify.CENTER -dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args5()) -rem ---------------------------------------------------------------------- -Dim args6(1) as new com.sun.star.beans.PropertyValue -args6(0).Name = "By" -args6(0).Value = 1 -args6(1).Name = "Sel" -args6(1).Value = true -dispatcher.executeDispatch(document, ".uno:GoDownToEndOfData", "", 0, args6()) -rem ---------------------------------------------------------------------- -Dim args7(0) as new com.sun.star.beans.PropertyValue -args7(0).Name = "aExtraWidth" -args7(0).Value = 254 -dispatcher.executeDispatch(document, ".uno:SetOptimalColumnWidth", "", 0, args7()) -rem ---------------------------------------------------------------------- -Dim args8(8) as new com.sun.star.beans.PropertyValue -args8(0).Name = "ByRows" -args8(0).Value = true -args8(1).Name = "HasHeader" -args8(1).Value = true -args8(2).Name = "CaseSensitive" -args8(2).Value = false -args8(3).Name = "IncludeAttribs" -args8(3).Value = true -args8(4).Name = "UserDefIndex" -args8(4).Value = 0 -args8(5).Name = "Col1" -args8(5).Value = 7 -args8(6).Name = "Ascending1" -args8(6).Value = true -args8(7).Name = "Col2" -args8(7).Value = 1 -args8(8).Name = "Ascending2" -args8(8).Value = true -dispatcher.executeDispatch(document, ".uno:DataSort", "", 0, args8()) -dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1()) -end sub -
diff --git a/META-INF/manifest.xml b/META-INF/manifest.xml @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<manifest:manifest xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" manifest:version="1.4" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0"> + <manifest:file-entry manifest:full-path="/" manifest:version="1.4" manifest:media-type="application/vnd.oasis.opendocument.spreadsheet"/> + <manifest:file-entry manifest:full-path="settings.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="meta.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/Standard/HandyTools.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/Standard/Sondage.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/Standard/BrochureGenerate.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/Standard/CylinderAutomation.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/Standard/GVTAdvance.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/Standard/AdGenerate.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/Standard/Scrap.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/Standard/script-lb.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Basic/script-lc.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="manifest.rdf" manifest:media-type="application/rdf+xml"/> + <manifest:file-entry manifest:full-path="Configurations2/" manifest:media-type="application/vnd.sun.xml.ui.configuration"/> + <manifest:file-entry manifest:full-path="styles.xml" manifest:media-type="text/xml"/> + <manifest:file-entry manifest:full-path="Thumbnails/thumbnail.png" manifest:media-type="image/png"/> + <manifest:file-entry manifest:full-path="content.xml" manifest:media-type="text/xml"/> +</manifest:manifest>+ \ No newline at end of file
diff --git a/Makefile b/Makefile @@ -0,0 +1,12 @@ +SHELL := sh +PYTHON ?= python + +.PHONY: pack unpack build import export clean +pack build import: + $(PYTHON) helper.py pack + +unpack export: + $(PYTHON) helper.py unpack + +clean: + rm -f SondageAutomation.ods;
diff --git a/PendingAutomation.ods b/PendingAutomation.ods Binary files differ.
diff --git a/README.md b/README.md @@ -0,0 +1,9 @@ +# Sondage Automation + +This directory holds the extracted contents of `SondageAutomation.ods`. Basic source code is editable at `Basic/Standard/*.bas`; the other workbook files, including sheets, settings, styles, and the thumbnail, keep their original ZIP paths. The generated `.ods` is not tracked in the latest Git tree. Earlier Git commits preserve the 2024 `git-original` sources and the 2026-09-14 `my-original` workbook. + +- `make pack` (or `python helper.py pack`) assembles the workbook, turning `.bas` files into Basic module XML inside the ZIP. It backs up an existing `SondageAutomation.ods` to `.ods.bak` before replacing it. +- `make unpack` (or `python helper.py unpack`) extracts edits made inside the workbook. **It overwrites the extracted source files**, so do not run it after editing `.bas` or other extracted files directly. +- `make clean` removes the generated workbook. + +`helper.py` uses only Python's standard library. Test report macros using a disposable workbook and isolated input/export paths.
diff --git a/Sondage.bas b/Sondage.bas @@ -1,746 +0,0 @@ -REM ***** BASIC ***** -Option Explicit - -Const FieldOperationLimit = 10 - -Type SondageOperation - OpName as String - OpLocation as String -End Type - -Type SondageStatement - Cond as Integer - Operand as String - OpIds() as Integer -End Type - -Type SondageField - Field as String - Width as Long - Statements() as SondageStatement - Values() as String -End Type - -Type SondageReport - Title as String - Settings() as com.sun.star.PropertyValue - Fields() as SondageField -End Type - -Type SondageConfiguration - Reports() as SondageReport - Headers() as String -End Type - -' FIXME Remove the 100 hard limit later -Dim OperationTable(100) as SondageOperation -Dim OperationTableLen% - -Function ColorRow(ByRef oSheet as Object, oRanges as Variant, highlightColor as Variant) - Dim oRange - For oRange = LBound(oRanges) To UBound(oRanges) - oRange.CellBackColor = highlightColor - Next -End Function - -Function ColumnOperation(ByRef oSheet as Object, oRanges as Variant, highlightColor as Variant) - Dim oRange - For oRange = LBound(oRanges) To UBound(oRanges) - oRange.CellBackColor = highlightColor - Next -End Function - -Function ColorCell(ByRef oSheet as Object, oRanges as Variant, highlightColor as Variant) - Dim oRange - For oRange = LBound(oRanges) To UBound(oRanges) - oRange.CellBackColor = highlightColor - Next -End Function - -Function Delete(ByRef oSheet as Object, oRanges as Variant, sArgs() as String) - Dim oRange - For Each oRange In oRanges - oSheet.removeByIndex(oRange.RangeAddress.StartRow) - Next oRange -End Function - -Sub SondageRegisterFunction(macroLocation$, macroName$) - OperationTable(OperationTableLen).OpLocation = macroLocation - OperationTable(OperationTableLen).OpName = macroName - OperationTableLen = OperationTableLen + 1 -End Sub - -Function _ReadUntilEndOrCharacter(ByRef sCell$, startIndex%, expect$, ByRef endIndex as Variant) as String - Dim c$, i% - c = Left(sCell, startIndex) - - For i = startIndex To Len(sCell) - If c = expect Then - _ReadUntilEndOrCharacter = Mid(sCell, startIndex, i - startIndex - 1) - endIndex = i - Exit Function - End If - - If c = "\n" Or c = ";" Then - ErrorLocal$ = "Expected '" & expect & "' got '" & c & "'" - Exit Function - End If - c = Mid(sCell, i, 1) - Next - _ReadUntilEndOrCharacter = Mid(sCell, startIndex, i - startIndex) - endIndex = i - 1 -End Function - -Function _ReadUntilCharacters(ByRef sCell$, startIndex%, expects() as Variant, ByRef endIndex&) as String - Dim c$, expect$ - - For endIndex = startIndex To Len(sCell) - c = Mid(sCell, endIndex, 1) - For Each expect In expects - If c = expect Then - _ReadUntilCharacters = Mid(sCell, startIndex, endIndex - startIndex) - Exit Function - End If - If c = "\n" Or c = ";" Then - ErrorLocal$ = "Expected '" & expect & "' got '" & c & "'" - Exit Function - End If - Next - Next - ErrorLocal$ = "Expected '" & expect & "' but reached end of cell" -End Function - -Sub TestSub - Dim sCell$, colName$ - Dim iCell% - sCell = "${variable with space} " & CHR(34) & "quoted string" & CHR(34) - colName = _ReadUntilCharacters(sCell, 3, Array("}"), iCell) - Print colName - If ErrorLocal$ <> "" Then - Print "Some error occurred: " & ErrorLocal - Exit Sub - End If - colName = _ReadUntilCharacters(sCell, iCell +3 , Array(CHR(34)), iCell) - If ErrorLocal$ <> "" Then - Print "Some error occurred: " & ErrorLocal - Exit Sub - End If - Print colName - 'If ErrorLocal$ <> "" Then - ' Print "Some error occurred: " & ErrorLocal - ' Exit Sub - 'End If -End Sub - -Function FunctionCall(colName$, actions) - Dim action$ - For Each action in actions - Print colName & " acts on " & action - Next 'action -End Function - -Function TokenDriver(Optional sCell) - Dim sonVars: sonVars = SondageReadSettings() - Dim si%: si = 1 - Dim tok$ - Dim tokType$ 'mode - If IsMissing(sCell) Then sCell = "${OrgCode}_Portln then @Area(.BadStyle @SomeOther Sort-ASCENDING)" - sCell = SondageExpandVariables(sCell, sonVars) - - Dim sCellLen: sCellLen = Len(sCell) - tok = GetToken(sCell, si, tokType) - While tok <> "" - Select Case tokType - Case "@" - Print "Some column types: "& tok - Case "(" - Print "Open Bracket: " & tok - Dim fi%: fi = 1 - Dim ftok$, ftokType$ - ftok = GetToken(tok, fi, ftokType) - While ftok <> "" - Print ftok - ftok = GetToken(tok, fi, ftokType) - Wend - Case "m" - Print "mode" - End Select - tok = GetToken(sCell, si, tokType) - Wend -End Function - -Function GetToken(sCell$, ByRef si%, ByRef m$) as String - Dim sonVars: sonVars = SondageReadSettings() - Dim sonState: SondageStatement: sonState = new SondageStatement - sCell = SondageExpandVariables(sCell, sonVars) - Dim sCellLen: sCellLen = Len(sCell) - Dim c$ 'current char - Dim endIndex& - Dim extract$ - Dim func$ - - For si = si To sCellLen - c = Mid(sCell, si, 1) - If c = "(" Then - extract = _ReadUntilCharacters(sCell, si + 1, Array(")"), endIndex) - si = endIndex - m = "(" - GetToken = extract - ElseIf c = "@" Or c = "." Then - m = c - If si + 1 < sCellLen Then - si = si + 1 - c = Mid(sCell, si, 1) - If c = "{" Then - extract = _ReadUntilCharacter(sCell, si + 1, "}", endIndex) - Else - extract = _ReadUntilCharacters(sCell, si, Array(" ", "(", ""), endIndex) - EndIf - If ErrorLocal$ <> "" Or endIndex > sCellLen Then - Print ErrorLocal$ - Exit Function - End If - If m = "@" Then 'Column mode - Print "Column is '" & extract & "'" - ElseIf m = "." Then - Print "Style is '" & extract & "'" - Else - Print "Probably a function: " & extract - End If - si = endIndex - GetToken = extract - Exit Function - End If - Else - m = "" - End If - Next 'si -End Function - -Function SondageGetOpId(macroName$) as Integer - Dim i% - SondageGetOpId = -1 - For i = 0 To OperationTableLen - If OperationTable(i).OpName = macroName Then - SondageGetOpId = i - Exit Function - End If - Next -End Function - -Function SondageValidateDoc(oDoc as Object, docType$) as String - Dim _err$ : _err = "" - If Not oDoc.supportsService(docType) Then - _err = oDoc.Title & " is not a valid Spreadsheet Document" - ElseIf oDoc.CurrentController.ViewControllerName = "PrintPreview" Then - _err = "Cannot run this macro in 'Print Preview', please close it and try again" - End If - SondageValidateDoc = _err -End Function - -Sub SondageCall(opId%, oSheet, Ranges) - Dim sonOp as SondageOperation: sonOp = OperationTable(opId) - Dim script - script=ThisComponent.scriptProvider.getScript("vnd.sun.star.script:" & sonOp.OpLocation & "." & sonOp.OpName & "?language=Basic&location=document") - script.invoke(Array(oSheet, Ranges), Array(), Array()) -End Sub - -Function SondageInferDocumentType(sonReports, aInputFiles as Variant) as SondageReport - Dim sonReport as SondageReport - Dim sonSetting as Object - Dim sMatch$, iMatch% - Dim aMatch as Variant - Dim sInputFile, iInputFile% - Dim matchCount - Dim iMatchLen%, iInputFileLen% - iInputFileLen = UBound(aInputFiles) - - For Each sonReport In sonReports - sMatch = SondageGetPropVal(sonReport.Settings, "Match") - If sMatch <> "" Then - aMatch = Split(sMatch, ";") - iMatchLen = UBound(aMatch) - if iMatchLen <> iInputFileLen Then Goto SONDAGE_REPORT_LOOP_END - SONDAGE_MATCH_LOOP_START: - For iMatch = iMatch To iMatchLen - sMatch = aMatch(iMatch) - For iInputFile = 0 To iInputFileLen - sInputFile = aInputFiles(iInputFile) - If (InStr(LCase(sInputFile), sMatch)) Then - iMatch = iMatch + 1 - Goto SONDAGE_MATCH_LOOP_START - End If - Next iInputFile - Next iMatch - End If - If iMatch = iInputFileLen + 1 Then - SondageInferDocumentType = sonReport - Exit Function - End If - SONDAGE_REPORT_LOOP_END: - Next sonReport -End Function - -Function SondageImportFiles(sondageReport as SondageReport, aInputFile as Variant, sDocType$, returnAlreadyOpenDoc as Boolean, Optional isHidden as Boolean) as Variant - Dim oDocs(0) as Variant - Dim iInputFile%, sInputFile$ - ReDim oDocs(0 To UBound(aInputFile)) as Variant - - For iInputFile = 0 To UBound(aInputFile) - sInputFile = aInputFile(iInputFile) - oDocs(iInputFile) = SondageImportFile(sondageReport, sInputFile, sDocType, returnAlreadyOpenDoc, isHidden) - If ErrorLocal$ <> "" Then Exit Function - Next iInputFile - SondageImportFiles = oDocs -End Function - -Function SondageImportFile(sondageReport as SondageReport, sInputFile$, sDocType$, returnAlreadyOpenDoc as Boolean, Optional isHidden as Boolean) as Variant - ' TODO Use import values from sheet - Dim oDoc - Dim fileUrl - Dim p(2) as new com.sun.star.beans.PropertyValue - If IsMissing(isHidden) Then isHidden = True - Dim delimiterList - Dim reportType$: reportType = sondageReport.Title - - If returnAlreadyOpenDoc Then - oDoc = ReturnComponentIfOpen(sInputFile) - If Not IsNull(oDoc) Then - SondageImportFile = oDoc - Exit Function - End If - End If - - delimiterList = Array(",", "|") - p(0).Name = "FilterName" - p(0).Value = CSV_FILTER_NAME - p(1).Name = "Hidden" - p(1).Value = isHidden - p(2).Name = "FilterOptions" - If reportType= "PENDING" Then - p(2).Value = PENDING_CSV_FILTER_OPTIONS - ElseIf reportType = "INSPECTION" Then - p(2).Value = INSPECTION_CSV_FILTER_OPTIONS - ElseIf reportType = "TUBE" Then - p(2).Value = TUBE_CSV_FILTER_OPTIONS - ElseIf reportType = "CONSUMERS" Then - p(2).Value = CONSUMERS_CSV_FILTER_OPTIONS - ElseIf reportType = "REFILL" Then - p(2).Value = REFILL_CSV_FILTER_OPTIONS - ElseIf reportType = "NCTC" Then - p(2).Value = NCTC_CSV_FILTER_OPTIONS - End If - fileUrl = ConvertToUrl(sInputFile) - If Not FileExists(fileUrl) Then - ErrorLocal = "Cannot open file '" & fileUrl & "'" - Exit Function - End If - oDoc = StarDesktop.loadComponentFromURL(fileUrl, "_blank", 0, p()) - ' We may check if imported the correct file, by checking the number of columns - 'If oDoc.Sheets(0).Columns.Count = 2 Then - ' MsgBox "Single column psv" - 'End If - - if IsEmpty(oDoc)Then - ErrorLocal = "Failed to get Document for " & sInputFile - Exit Function - End If - - ErrorLocal = SondageValidateDoc(oDoc, sDocType) - If ErrorLocal <> "" Then - Exit Function - End If - SondageImportFile = oDoc -End Function - -Sub SondageGenerateReport(sondageReport, oDoc) - Print sondageReport.Title -End Sub - -Function SondageReadSettings() as Variant - Dim oDoc - Dim oSheet - Dim rangeAddress - Dim oRange - Dim iCell%, sKey$, sVal$ - Dim sonVars: sonVars = new Collection - - oSheet = ThisComponent.Sheets.getByName("Settings") - If IsNull(oSheet) Then - ErrorLocal$ = "Cannot find 'Settings' sheet" - Exit Function - End If - oRange = UsedRangeCursor(oSheet)'.RangeAddress - rangeAddress = oRange.RangeAddress - - For iCell = rangeAddress.StartRow To rangeAddress.EndRow - sKey = oRange.getCellByPosition(0, iCell).String - If sKey <> "" Then - sVal = oRange.getCellByPosition(1, iCell).String - sonVars.Add(item := sVal, key := sKey) - End If - Next 'iCell - SondageReadSettings = sonVars -End Function - -Sub SondageMain() - Dim sonReports() as Variant - Dim sonFields() as Variant - Dim sonReport, sonField, sonStatement - Dim iOpsLen%, iOp%, opId% - Dim sInputFile$: sInputFile = "C:\Users\bhara\Desktop\GetPendingOrderConsumerDetailsDateRange(36).csv" - Dim oDoc, oSheet, oUsedRange - - sonConf = SondageParseFieldConfiguration() - If ErrorLocal$ <> "" Then - MsgBox ErrorLocal$, 16 - Exit Sub - End If - - sonReports = sonConf.Reports - sonReport = SondageInferDocumentType(sonReports, sInputFile) - oDoc = SondageImportFile(sonReport, sInputFile, True, False) - - ' Copy the first, sheet if there is only one sheet in document - If oDoc.Sheets.Count = 1 Then - oDoc.Sheets.copyByName(oOrigSheet.Name, reportType & "WorkingCopy", 1) - End If - oSheet = oDoc.Sheets(1) - 'oSheet = oDoc.getSheets().getByIndex(0) - oUsedRange = UsedRangeCursor(oSheet) - If IsNull(oSheet) Then - MsgBox "Input file is null", 16 - Exit Sub - End If - - sonFields = sonReport.Fields - Dim str$ - - For Each sonField In sonFields - 'If Not IsEmpty(sonField) Then - str = sonReport.Title & ": Field Variables: " & sonField.Field & ", with width: " & sonField.Width & " with " & UBound(sonField.Statements) & " statements" - For Each sonStatement In sonField.Statements - iOpsLen = UBound(sonStatement.OpIds) - str = str & " has condition " & sonStatement.Cond & " for " & sonStatement.Operand & " " & "Operations: " & " " - Call SondageFilterColumn(oSheet, endColumn, endRow, "Area", orgCode & "_PortIn", sonStatement.Cond) - For iOp = 0 To iOpsLen - opId = sonStatement.OpIds(iOp) - str = str & opId - SondageCall(opId, oSheet, oRange) - Next - Print str - Next - Next -End Sub - -Sub SondageFilterColumns(oSheet) - Dim oFilterDesc - Dim filterRange, oRange - Dim oCursor, o, oColumnHeader, oDescriptor - Dim newColumn : newColumn = endColumn + 1 - Dim oFields(0) as new com.sun.star.sheet.TableFilterField - Dim filterCount as Long - Dim filterColumnName as String - Dim endRow& - Dim filterContent as Variant, filterOperator as Variant - - If IsMissing(filterOperator) Then filterOperator = com.sun.star.sheet.FilterOperator.EQUAL - Print filterOperator - - On Error Goto ErrorHandler - - oRange = oSheet.getCellRangeByPosition(newColumn, 0, newColumn, endRow) - oColumnHeader = oRange.getCellByPosition(0, 0) - oColumnHeader.setString("0") - - oDescriptor = oSheet.createReplaceDescriptor() - - filterRange = GetColumnRange(oSheet, endColumn, endRow, filterColumnName) - oFilterDesc = filterRange.createFilterDescriptor(True) - - With oFields(0) - .Field = filterRange.RangeAddress.StartColumn - .IsNumeric = IsNumeric(filterContent) - .Operator = filterOperator - .StringValue = filterContent - .NumericValue = filterContent - End With - - oFilterDesc.setFilterFields(oFields()) - oFilterDesc.ContainsHeader = True - oFilterDesc.UseRegularExpressions = False - oSheet.filter(oFilterDesc) - - ' TODO Check if there is a way to remove the 50,000 limit - oRange.fillSeries(com.sun.star.sheet.FillDirection.TO_BOTTOM, com.sun.star.sheet.FillMode.SIMPLE, 0, 1, 50000) - SortColumn(oSheet, 0, 1, newColumn, endRow, "0") - -ErrorHandler: - oSheet.filter(oSheet.createFilterDescriptor(True)) - oSheet.Columns.removeByIndex(newColumn, 1) - Reset -End Sub - -Function SondageExpandVariables(sCell$, sonVars as Variant, Optional varType$) as String - Dim sCellLen: sCellLen = Len(sCell) - Dim c$ - Dim si%, endIndex as Long - Dim extract$, varState as Boolean - - If IsMissing(varType) Then varType = "$" - - For si = 1 To sCellLen - c = Mid(sCell, si, 1) - If c = varType Then - varState = True - ElseIf varState = True Then - c = Mid(sCell, si, 1) - If c = "{" Then - extract = _ReadUntilCharacters(sCell, si + 1, Array("}"), endIndex) - Else - extract = _ReadUntilEndOrCharacter(sCell, si, " ", endIndex) - EndIf - If ErrorLocal$ <> "" Or endIndex > sCellLen Then - Print ErrorLocal$ - Exit Function - End If - SondageExpandVariables = SondageExpandVariables & sonVars.Item(extract) - si = endIndex - varState = False - Else - SondageExpandVariables = SondageExpandVariables & c - End If - Next 'si -End Function - -Function SondageGetCondTypeFromString(opCond$) as Integer - Dim condType% - condType = com.sun.star.sheet.ConditionOperator.EQUAL - SondageGetCondTypeFromString = condType - - If TypeName(opCond) <> "String" or Len(opCond) = 0Then - condType = com.sun.star.sheet.ConditionOperator.NONE - Exit Function - End If - - Select Case opCond - Case "<=" - condType = com.sun.star.sheet.ConditionOperator.LESS_EQUAL - Case ">=" - condType = com.sun.star.sheet.ConditionOperator.GREATER_EQUAL - Case "<>" - condType = com.sun.star.sheet.ConditionOperator.NOT_EQUAL - Case "><" - condType = com.sun.star.sheet.ConditionOperator.BETWEEN - Case "==" - condType = com.sun.star.sheet.ConditionOperator.EQUAL - Case Else - ' Check the first letter - Select Case Left(opCond, 1) - Case "<" - condType = com.sun.star.sheet.ConditionOperator.LESS - Case ">" - condType = com.sun.star.sheet.ConditionOperator.GREATER - Case "+" - condType = com.sun.star.sheet.ConditionOperator.FORMULA - End Select - End Select - SondageGetCondTypeFromString = condType -End Function - -Function _RemoveAllPrivateNamedRanges() - Dim aNamedRanges, sNamedRange, i% - aNamedRanges = ThisComponent.NamedRanges - For i = 0 To aNamedRanges.getCount() - 1 - sNamedRange = aNamedRanges.getByIndex(i).Name - If InStr(1, sNamedRange, "Sondage_", 0) = 1 Then ' sNamedRange starts with Sondage - aNamedRanges.removeByName(sNamedRange) - End If - Next i -End Function - -Function SondageParseFieldConfiguration() as SondageConfiguration - Dim reportNames, aValues - Dim oDoc, oSheet, oRange, oSearchRange - Dim startRow&, endRow&, endColumn&, iRow&, iCol& - Dim sCell, oCell - - ' Used for ReDim Statements and Fields - Dim sonConf as SondageConfiguration - Dim sonReports() as SondageReport - Dim sonStatements() as Variant - Dim sonFields() as Variant - Dim sonSettings() as Variant - Dim opIds() as Integer - - ' Remove OperationLimit later - Dim stTokens(200) as String - - Dim sonReport as new SondageReport - Dim sonField as new SondageField - Dim sonStatement as new SondageStatement - - Dim iWidth - Dim sStatements() as String, aHeaders() as String, sStatement$, sWidth$, opCond$ - Dim opTokens() as String - - SondageRegisterFunction("Standard.Sondage", "Select") - ' TODO Stub operation delete later - ' This is probably the modern verision of VLOOKUP that is based on column name - ' If something exists like this in Excel or Calc, just use its name - SondageRegisterFunction("Standard.Sondage", "ColumnOperation") - SondageRegisterFunction("Standard.Sondage", "ColorCell") - SondageRegisterFunction("Standard.Sondage", "ColorRow") - SondageRegisterFunction("Standard.Sondage", "Delete") - - oDoc = ThisComponent - oSheet = oDoc.getSheets().getByName("FieldConfiguration") - - oRange = UsedRangeCursor(oSheet) - startRow = 0 - endRow = oRange.RangeAddress.EndRow - endColumn = oRange.RangeAddress.EndColumn - - ReDim Preserve aHeaders(endColumn) as String - For iCol = 0 To endColumn - aHeaders(iCol) = oSheet.getCellByPosition(iCol, iRow).getString() - Next iCol - - For iRow = startRow To endRow - oCell = oSheet.getCellByPosition(0, iRow) - sCell = oCell.getText().String - If Left(sCell, 1) = "[" Then - ReDim Preserve sonReports(UBound(sonReports) + 1) as SondageReport - sonReport = sonReports(UBound(sonReports)) - sonReport.Fields = Array() - sonReport.Settings = Array() - ' TODO Restrict the Title to certain values - sonReport.Title = Mid(sCell, 2, Len(sCell) - 2) - oCell.CellStyle = "Heading1" - 'Print sonReport.Title - ElseIf Len(sonReport.Title) <> 0 Then - If Left(sCell, 1) = "@" Then - sonField = new SondageField - sonField.Field = Mid(sCell, 2) - - aValues = sonField.Values - ReDim aValues(endColumn) - For iCol = 0 To endColumn - aValues(iCol) = oSheet.getCellByPosition(iCol, iRow).getString() - Next iCol - sonField.Values = aValues - - sonField.Statements = Array() - sStatements = Split( _ - Trim(oSheet.getCellByPosition(1, iRow).getText().String), _ - CHR(13) _ - ) - sWidth = oSheet.getCellByPosition(2, iRow).getText().String - If sWidth = "0" Then - iWidth = 0 - ElseIf sWidth = "-1" or Len(sWidth) = 0 Then - ' Mark for deletion - iWidth = -1 - Else - iWidth = CLng(sWidth) - End If - sonField.Width = iWidth - For Each sStatement In sStatements - Dim ci: ci = 0 - Dim c$, pc$ - - For ci = 1 To Len(sStatement) - c = Mid(sStatement, ci, 1) - If c = "$" Then - ' Read the rest of the word and store in a variable - ' This variable should be replaced with content from a collection above - ' Essentially implementing a variable like function - End If - Next - stTokens = Split(sStatement, " then ") - sonStatement = new SondageStatement - - Dim stToken - Dim opToken$ - - If UBound(stTokens) = 0 Then - ' Operand Only - sonStatement.Operand = Trim(stTokens(0)) - 'Print sonReport.Title & "Operand Only: " & stTokens(0) - opTokens = Array() - ElseIf UBound(stTokens) > 0 Then - ' Cond then Op - opCond = Left(stTokens(0), 2) - - sonStatement.Cond = SondageGetCondTypeFromString(opCond) - - If sonStatement.Cond = com.sun.star.sheet.ConditionOperator.EQUAL Then - sonStatement.Operand = Trim(stTokens(0)) - Else - sonStatement.Operand = Trim(Right(stTokens(0), Len(stTokens(0)) - 2) ) - End If - End If 'UBound(stTokens) - - ' After Reading the condition, save the operation after finding the Id - If UBound(stTokens) > 0 Then - opTokens = Split(stTokens(1), ",") - For Each opToken In opTokens - Dim opPureTokens() as String - Dim opPureToken$ - Dim sonOpId%: sonOpId = -1 - opPureTokens = Split(Trim(opToken), "(") - If UBound(opPureTokens) = -1 Then - ErrorLocal$ = "FATAL: Error in row: " & iRow & ", Operation is malformed" - Exit Function - End If - opPureToken = Trim(opPureTokens(0)) - If Left(opPureToken, 1) = "@" Then - Print "This is a @ column thing: " & opPureToken - ' TODO Construct optoken and id and push the instructions to list - ' FIXME This does not do much now - sonOpId = SondageGetOpId("ColumnOperation") - Else - sonOpId = SondageGetOpId(opPureToken) - End If - If sonOpId = -1 Then - ErrorLocal$ = "FATAL: Cannot retrieve the operation " & opPureToken & " in row " & iRow - Exit Function - End If - opIds = sonStatement.OpIds - ReDim Preserve opIds(UBound(sonStatement.OpIds) + 1) as Integer - sonStatement.OpIds = opIds - sonStatement.OpIds(UBound(sonStatement.OpIds)) = sonOpId - Next 'opToken - Else - opTokens = Array(0) - End If - - sonStatements = sonField.Statements - ReDim Preserve sonStatements(UBound(sonField.Statements) + 1) as Variant - sonField.Statements = sonStatements - sonField.Statements(UBound(sonField.Statements)) = sonStatement - Next 'sOp - - sonFields = sonReport.Fields - ReDim Preserve sonFields(UBound(sonFields) + 1) as Variant - sonReport.Fields = sonFields - sonReport.Fields(UBound(sonReport.Fields)) = sonField - Else ' If != [ and != @ - sonSettings = sonReport.Settings - ReDim Preserve sonSettings(UBound(sonSettings) + 1) as Variant - sonSettings(UBound(sonSettings)) = CreateObject("com.sun.star.beans.PropertyValue") - sonSettings(UBound(sonSettings)).Name = sCell - sonSettings(UBound(sonSettings)).Value = oSheet.getCellByPosition(1, iRow).getText().String - oCell.CellStyle = "Card" - sonReport.Settings = sonSettings - End If - Else - MsgBox "Syntax Error: should start with [HEADER] element", 16 - Exit Function - End If - Next 'iRow - sonConf.Reports = sonReports - sonConf.Headers = aHeaders - SondageParseFieldConfiguration = sonConf -End Function -
diff --git a/content.xml b/content.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.4"><office:scripts/><office:font-face-decls><style:font-face style:name="HG Mincho Light J" svg:font-family="'HG Mincho Light J'" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans Unicode MS" svg:font-family="'Liberation Sans Unicode MS'" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans1" svg:font-family="'Liberation Sans'" style:font-adornments="Fett" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-adornments="Negrito" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Lucida Sans" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Microsoft YaHei" svg:font-family="'Microsoft YaHei'" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:automatic-styles><style:style style:name="co5" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="2.656cm"/></style:style><style:style style:name="co6" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="3.616cm"/></style:style><style:style style:name="co7" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="2.505cm"/></style:style><style:style style:name="co8" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="2.484cm"/></style:style><style:style style:name="co4" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="2.258cm"/></style:style><style:style style:name="co9" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="3.593cm"/></style:style><style:style style:name="co10" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="5.667cm"/></style:style><style:style style:name="co12" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="5.029cm"/></style:style><style:style style:name="co13" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="9.488cm"/></style:style><style:style style:name="co14" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="8.146cm"/></style:style><style:style style:name="co15" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="4.627cm"/></style:style><style:style style:name="co16" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="5.613cm"/></style:style><style:style style:name="co17" style:family="table-column"><style:table-column-properties fo:break-before="auto" style:column-width="3.33cm"/></style:style><style:style style:name="ro1" style:family="table-row"><style:table-row-properties style:row-height="0.452cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ro5" style:family="table-row"><style:table-row-properties style:row-height="1.236cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ro3" style:family="table-row"><style:table-row-properties style:row-height="0.517cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ro4" style:family="table-row"><style:table-row-properties style:row-height="0.841cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ro6" style:family="table-row"><style:table-row-properties style:row-height="1.632cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ro7" style:family="table-row"><style:table-row-properties style:row-height="0.822cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ro8" style:family="table-row"><style:table-row-properties style:row-height="2.422cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ro9" style:family="table-row"><style:table-row-properties style:row-height="2.027cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ro10" style:family="table-row"><style:table-row-properties style:row-height="1.616cm" fo:break-before="auto" style:use-optimal-row-height="true"/></style:style><style:style style:name="ta1" style:family="table" style:master-page-name="Default"><style:table-properties table:display="true" style:writing-mode="lr-tb"/></style:style><number:boolean-style style:name="N99"><number:boolean/></number:boolean-style><style:style style:name="ce31" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N99"/><style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:padding="0.071cm"/></style:style><style:style style:name="ce21" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:border-bottom="0.74pt solid #000000" fo:border-left="0.74pt solid #000000" fo:border-right="none" fo:border-top="0.74pt solid #000000"/></style:style><style:style style:name="ce22" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:border-bottom="none" fo:border-left="0.74pt solid #000000" fo:border-right="none" fo:border-top="none"/></style:style><style:style style:name="ce23" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:border-bottom="0.74pt solid #000000" fo:border-left="0.74pt solid #000000" fo:border-right="none" fo:border-top="none"/></style:style><style:style style:name="ce2" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:background-color="#ffff00" fo:padding="0.071cm"/></style:style><style:style style:name="ce3" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:background-color="#ff0000" fo:padding="0.071cm"/></style:style><style:style style:name="ce8" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N99"><style:table-cell-properties fo:padding="0.071cm"/></style:style><style:style style:name="ce18" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N99"/><style:style style:name="ce10" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:padding="0.071cm"/><style:text-properties fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/></style:style><style:style style:name="ce30" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:border-bottom="none" fo:border-left="none" fo:border-right="0.74pt solid #000000" fo:border-top="0.74pt solid #000000"/></style:style><style:style style:name="ce32" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:border-bottom="none" fo:border-left="none" fo:border-right="0.74pt solid #000000" fo:border-top="none"/></style:style><style:style style:name="ce40" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:border-bottom="0.74pt solid #000000" fo:border-left="none" fo:border-right="0.74pt solid #000000" fo:border-top="none"/></style:style><style:style style:name="ce13" style:family="table-cell" style:parent-style-name="Comments"><style:text-properties fo:color="#808080"/></style:style><style:style style:name="ce11" style:family="table-cell" style:parent-style-name="Default"><style:text-properties fo:color="#999999"/></style:style><style:style style:name="ce14" style:family="table-cell" style:parent-style-name="Comments"><style:table-cell-properties fo:wrap-option="wrap"/><style:text-properties fo:color="#808080"/></style:style><style:style style:name="ce16" style:family="table-cell" style:parent-style-name="Comments"><style:table-cell-properties fo:wrap-option="wrap"/><style:paragraph-properties fo:margin-left="0cm"/><style:text-properties fo:color="#808080"/></style:style><style:style style:name="ce42" style:family="table-cell" style:parent-style-name="Heading_20_1"><style:table-cell-properties style:diagonal-bl-tr="none" style:diagonal-tl-br="none"/></style:style><style:style style:name="ce43" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:border="none"/></style:style><style:style style:name="ce44" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:border="none"/></style:style><style:style style:name="ce45" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:wrap-option="wrap"/></style:style><style:style style:name="ce53" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:wrap-option="wrap" fo:border="none"/></style:style><style:style style:name="ce55" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:wrap-option="wrap" fo:border="none"/><style:text-properties fo:color="#000000"/></style:style><style:style style:name="ce56" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties style:diagonal-bl-tr="none" style:diagonal-tl-br="none"/><style:text-properties style:use-window-font-color="true"/></style:style><style:style style:name="ce57" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:wrap-option="wrap"/><style:text-properties style:use-window-font-color="true"/></style:style><style:style style:name="gr1" style:family="graphic" style:parent-style-name="Default"><style:graphic-properties fo:background-color="#81d41a" loext:decorative="false"/></style:style><style:style style:name="P1" style:family="paragraph"><style:paragraph-properties fo:text-align="center"/></style:style><style:style style:name="T1" style:family="text"><style:text-properties style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color"/></style:style><style:style style:name="T2" style:family="text"><style:text-properties style:use-window-font-color="true" fo:font-size="10pt" fo:font-weight="normal" style:font-name-asian="Liberation Sans" style:font-name-complex="Liberation Sans" style:font-size-asian="10pt" style:font-size-complex="10pt" style:font-weight-asian="normal" style:font-weight-complex="normal"/></style:style><style:style style:name="T3" style:family="text"><style:text-properties style:font-name="Liberation Sans" fo:font-size="10pt" fo:font-weight="normal" style:text-underline-style="none" style:text-underline-color="font-color" style:text-line-through-type="none" fo:font-style="normal" style:text-outline="false" fo:text-shadow="none" style:text-line-through-mode="continuous" fo:language="en" fo:country="IN" style:language-asian="zh" style:country-asian="CN" style:language-complex="hi" style:country-complex="IN" style:font-name-asian="Microsoft YaHei" style:font-name-complex="Lucida Sans" style:font-size-asian="10pt" style:font-size-complex="10pt" style:font-weight-asian="normal" style:font-weight-complex="normal" style:font-style-asian="normal" style:font-style-complex="normal" style:text-emphasize="none" style:font-relief="none" style:text-overline-style="none" style:text-overline-color="font-color"/></style:style></office:automatic-styles><office:body><office:spreadsheet><table:calculation-settings table:automatic-find-labels="false" table:use-regular-expressions="false" table:use-wildcards="true"/><table:content-validations><table:content-validation table:name="val1" table:condition="of:cell-content-is-in-list("AUTO";"PENDING";"REFILL";"INSPECTION";"SBC";"EKYC";"CONSUMERS";"VIP";"DORMANT")" table:allow-empty-cell="true" table:display-list="unsorted" table:base-cell-address="Settings.B8"><table:error-message table:message-type="stop" table:display="true"/></table:content-validation><table:content-validation table:name="val2" table:condition="of:cell-content-is-in-list("C:\Users\bhara\Downloads\EKYCPendingCustomersReportForDist.csv";"C:\Users\bhara\Downloads\GetPendingOrderConsumerDetailsDateRange.csv";"C:\Users\bhara\Downloads\RefillDetails.csv";"")" table:allow-empty-cell="true" table:display-list="unsorted" table:base-cell-address="Settings.B17"><table:error-message table:message-type="stop" table:display="true"/></table:content-validation></table:content-validations><table:table table:name="Settings" table:style-name="ta1"><office:forms form:automatic-focus="false" form:apply-design-mode="false"><form:form form:name="Form" form:apply-filter="true" form:command-type="table" form:control-implementation="ooo:com.sun.star.form.component.Form" office:target-frame=""><form:properties><form:property form:property-name="PropertyChangeNotificationEnabled" office:value-type="boolean" office:boolean-value="true"/><form:property form:property-name="TargetURL" office:value-type="string" office:string-value=""/></form:properties><form:button form:name="RunButton" form:control-implementation="ooo:com.sun.star.form.component.CommandButton" xml:id="control1" form:id="control1" form:label="Run ▶" office:target-frame="" form:default-button="true" form:delay-for-repeat="PT0.050000000S" form:image-position="center"><form:properties><form:property form:property-name="DefaultControl" office:value-type="string" office:string-value="com.sun.star.form.control.CommandButton"/><form:property form:property-name="HelpText" office:value-type="string" office:string-value="Run Main with DebugInputFile"/><form:property form:property-name="Referer" office:value-type="string" office:string-value="file:///C:/Program%20Files/SKGA%20Automation/PendingAutomation.ods/content.xml"/></form:properties><office:event-listeners><script:event-listener script:language="ooo:script" script:event-name="form:performaction" xlink:href="vnd.sun.star.script:Standard.CylinderAutomation.Main?language=Basic&location=document" xlink:type="simple"/></office:event-listeners></form:button></form:form></office:forms><table:table-column table:style-name="co12" table:default-cell-style-name="Default"/><table:table-column table:style-name="co13" table:default-cell-style-name="Default"/><table:table-column table:style-name="co14" table:default-cell-style-name="ce11"/><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Setting Name</text:p></table:table-cell><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Setting Value</text:p></table:table-cell><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Comments</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro3"><table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string"><text:p>OrgCode</text:p></table:table-cell><table:table-cell table:style-name="ce1" office:value-type="float" office:value="110820" calcext:value-type="float"><text:p>110820</text:p></table:table-cell><table:table-cell table:style-name="ce13" office:value-type="string" calcext:value-type="string"><text:p>Organization code if any</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>StateName</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>TAMIL NADU</text:p></table:table-cell><table:table-cell table:style-name="ce13"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>CityName</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>CHENNAI</text:p></table:table-cell><table:table-cell table:style-name="ce13"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>CurrencyUnit</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>₹</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro4"><table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string"><text:p>HighlightColor</text:p></table:table-cell><table:table-cell table:style-name="ce2"/><table:table-cell table:style-name="ce13" office:value-type="string" calcext:value-type="string"><text:p>Hightlight operations will be highlighted with this color</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro3"><table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string"><text:p>ExportFolder</text:p></table:table-cell><table:table-cell table:style-name="ce1" table:formula="of:=ENV("USERPROFILE")&"\Sync"" office:value-type="string" office:string-value="C:\Users\bhara\Sync" calcext:value-type="string"><text:p>C:\Users\bhara\Sync</text:p></table:table-cell><table:table-cell table:style-name="ce13" office:value-type="string" calcext:value-type="string"><text:p>Reports will be exported to this folder.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro6"><table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string"><text:p>ReportType</text:p></table:table-cell><table:table-cell table:style-name="ce1" table:content-validation-name="val1" office:value-type="string" calcext:value-type="string"><text:p>AUTO</text:p></table:table-cell><table:table-cell table:style-name="ce14" office:value-type="string" calcext:value-type="string"><text:p>Available values can be switched by activated the cell’s drop-down. It is recommended to leave this option at “AUTO” and rename the input file accordingly.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro5"><table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string"><text:p>ReportFilter</text:p></table:table-cell><table:table-cell table:style-name="ce1"/><table:table-cell table:style-name="ce14" office:value-type="string" calcext:value-type="string"><text:p>This can be used to set any filters to the specified reportType. Currently only “”(NULL) or “ONLINE” is supported.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro3"><table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string"><text:p>PriorityThreshold</text:p></table:table-cell><table:table-cell table:style-name="ce1" office:value-type="float" office:value="3" calcext:value-type="float"><text:p>3</text:p></table:table-cell><table:table-cell table:style-name="ce13"/></table:table-row><table:table-row table:style-name="ro3"><table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string"><text:p>PriorityColor</text:p></table:table-cell><table:table-cell table:style-name="ce3"/><table:table-cell table:style-name="ce13"/></table:table-row><table:table-row table:style-name="ro3"><table:table-cell table:style-name="ce1" office:value-type="string" calcext:value-type="string"><text:p>EnableGroupReports</text:p></table:table-cell><table:table-cell table:style-name="ce8" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"><text:p>TRUE</text:p></table:table-cell><table:table-cell table:style-name="ce13" office:value-type="string" calcext:value-type="string"><text:p>If “FALSE”, only the SUMMARY will be exported.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro4"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>OrganizeInputsFolder</text:p></table:table-cell><table:table-cell table:style-name="ce1" table:formula="of:=ENV("USERPROFILE")&"\Documents\BharatgasSource"" office:value-type="string" office:string-value="C:\Users\bhara\Documents\BharatgasSource" calcext:value-type="string"><text:p>C:\Users\bhara\Documents\BharatgasSource</text:p></table:table-cell><table:table-cell table:style-name="ce16" office:value-type="string" calcext:value-type="string"><text:p>If a path is given, the given input file is stored in this folder automagically with proper names.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro5"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>RemoveInputFileAfterSuccess</text:p></table:table-cell><table:table-cell table:style-name="ce18" office:value-type="boolean" office:boolean-value="false" calcext:value-type="boolean"><text:p>FALSE</text:p></table:table-cell><table:table-cell table:style-name="ce14" office:value-type="string" calcext:value-type="string"><text:p>Removes the input file if set to “TRUE”. Use with caution! Can be used in conjunction with “OrganizeInputsFolder”.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>GVTSoftwareFolder</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>C:\Program Files\GVT Advance</text:p></table:table-cell><table:table-cell table:style-name="ce13"/></table:table-row><table:table-row table:style-name="ro3"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>CustomerDBFile</text:p></table:table-cell><table:table-cell table:style-name="ce10" office:value-type="string" calcext:value-type="string"><text:p>C:\Users\bhara\Downloads\ListOfConsumers.csv</text:p></table:table-cell><table:table-cell table:style-name="ce13" office:value-type="string" calcext:value-type="string"><text:p>Required for address option of pending list</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro7"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>DebugInputFile</text:p><draw:control draw:z-index="0" draw:name="Control 1" draw:style-name="gr1" draw:text-style-name="P1" svg:width="1.159cm" svg:height="0.604cm" svg:x="3.68cm" svg:y="0.083cm" draw:control="control1"/></table:table-cell><table:table-cell table:style-name="ce1" table:content-validation-name="val2" office:value-type="string" calcext:value-type="string"><text:p>C:\Users\bhara\Downloads\EKYCPendingCustomersReportForDist.csv</text:p></table:table-cell><table:table-cell table:style-name="ce13" office:value-type="string" calcext:value-type="string"><text:p>Developer Option. Will be used as default input file when debugging</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ImportDelimeterOrder</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>,|</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ShouldSyncWithGVT</text:p></table:table-cell><table:table-cell table:style-name="ce18" office:value-type="boolean" office:boolean-value="false" calcext:value-type="boolean"><text:p>FALSE</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro8"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>PendingRemarksValidateList</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p> </text:p><text:p>DELIVERED</text:p><text:p>EKYC PENDING</text:p><text:p>CANT REACH CUSTOMER</text:p><text:p>DELIVER</text:p><text:p>DOOR LOCK</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce21" office:value-type="string" calcext:value-type="string" table:number-columns-spanned="1" table:number-rows-spanned="3"><text:p>PendingRemarksValidateList</text:p></table:table-cell><table:table-cell table:style-name="ce30" office:value-type="string" calcext:value-type="string"><text:p>DELIVERED</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:covered-table-cell table:style-name="ce22"/><table:table-cell table:style-name="ce32" office:value-type="string" calcext:value-type="string"><text:p>EKYC PENDING</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:covered-table-cell table:style-name="ce23"/><table:table-cell table:style-name="ce40" office:value-type="string" calcext:value-type="string"><text:p>CANT REACH CUSTOMER</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro4"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>EkycRemarksList</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p> </text:p><text:p>CALLED</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>UserFriendlySubtotals</text:p></table:table-cell><table:table-cell table:style-name="ce18" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"><text:p>TRUE</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1" table:number-rows-repeated="1048550"><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:number-columns-repeated="3"/></table:table-row></table:table><table:table table:name="PriceList" table:style-name="ta1"><table:table-column table:style-name="co5" table:default-cell-style-name="Default"/><table:table-column table:style-name="co6" table:default-cell-style-name="Default"/><table:table-column table:style-name="co7" table:default-cell-style-name="Default"/><table:table-column table:style-name="co8" table:default-cell-style-name="Default"/><table:table-column table:style-name="co4" table:default-cell-style-name="Default"/><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Product Name</text:p></table:table-cell><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Title</text:p></table:table-cell><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Buying Price</text:p></table:table-cell><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Selling Price</text:p></table:table-cell><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Remarks</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro5"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>2BurnerSS</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Arya/Surya</text:p><text:p>Bharat Hi-Star Stove</text:p><text:p/></table:table-cell><table:table-cell office:value-type="float" office:value="2350" calcext:value-type="float"><text:p>2350</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="2599" calcext:value-type="float"><text:p>2599</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>2BurnerSS EE</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="2100" calcext:value-type="float"><text:p>2100</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="2500" calcext:value-type="float"><text:p>2500</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>3BurnerSS EE</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="3000" calcext:value-type="float"><text:p>3000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="3500" calcext:value-type="float"><text:p>3500</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>4BurnerSS</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="4000" calcext:value-type="float"><text:p>4000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="4500" calcext:value-type="float"><text:p>4500</text:p></table:table-cell><table:table-cell/></table:table-row></table:table><table:table table:name="FieldAliases" table:style-name="ta1"><table:table-column table:style-name="co9" table:default-cell-style-name="Default"/><table:table-column table:style-name="co4" table:default-cell-style-name="Default"/><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>@</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>AreaCodeDesc</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Area_Name</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>AreaDescription</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Consumer_Address</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Address</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Consumer_Number</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ID</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ConsumerNumber</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ID</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ConsumerName</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Name</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>consumername</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Name</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>eKYCOperatorName</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Operator Name</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Consumer_Type</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Consumer Type</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ConsumerTypeIdDesc</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Type</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Consumer_Name</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Name</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>OTPMobileNumber</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>OTP Number</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ConsumerNumber1</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ID</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>EmailId</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Email</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>MobileNumber</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Mobile</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>MobileNumber1</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Mobile</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>PhoneNumber</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Phone</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>BookDate</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Book</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ProductCode</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Code</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>conSumerName</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Name</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ConsumerAddress</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Address</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>MobileNo</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Mobile</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p><text:a xlink:href="mailto:PENDING@Area" xlink:type="simple">PENDING@Area</text:a></text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>East</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>E.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>West</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>W.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>South</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>S.</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>North</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>N.</text:p></table:table-cell></table:table-row></table:table><table:table table:name="StyleDefinitions" table:style-name="ta1"><table:table-column table:style-name="co10" table:default-cell-style-name="Default"/><table:table-column table:style-name="co4" table:default-cell-style-name="Default"/><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>[*StyleFamilies.PageStyle.Default]</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>PrintGrid</text:p></table:table-cell><table:table-cell table:style-name="ce18" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"><text:p>TRUE</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>CenterHorizontally</text:p></table:table-cell><table:table-cell table:style-name="ce18" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"><text:p>TRUE</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>HeaderIsOn</text:p></table:table-cell><table:table-cell table:style-name="ce18" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"><text:p>TRUE</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>HeaderShared</text:p></table:table-cell><table:table-cell table:style-name="ce18" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"><text:p>TRUE</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>FirstPageHeaderIsShared</text:p></table:table-cell><table:table-cell table:style-name="ce18" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"><text:p>TRUE</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>[.Warning]</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Font</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Trebuchet</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>FontSize</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="24" calcext:value-type="float"><text:p>24</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>[.Bad]</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Background</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Red</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Color</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>White</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>FontSize</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="12" calcext:value-type="float"><text:p>12</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Font</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Segoe UI</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>[.OnlinePayment]</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>CellBack</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>#FFFF00</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Color</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>#000000</text:p></table:table-cell></table:table-row></table:table><table:table table:name="FieldConfiguration" table:style-name="ta1"><office:forms form:automatic-focus="false" form:apply-design-mode="false"/><table:table-column table:style-name="co15" table:default-cell-style-name="Default"/><table:table-column table:style-name="co16" table:default-cell-style-name="ce45"/><table:table-column table:style-name="co17" table:default-cell-style-name="Default"/><table:table-column table:style-name="co4" table:default-cell-style-name="Default"/><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce42" office:value-type="string" calcext:value-type="string"><text:p>[PENDING]</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce42" office:value-type="string" calcext:value-type="string"><text:p>Group Width</text:p></table:table-cell><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>Width</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro7"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Match</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>GetPendingOrderConsumerDetailsDateRange</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro9"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>RequireDB</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>1 // This should be moved to sources, which also the facility to have add other csv and Match should be used for verification and auto piloting</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>millennium.ots</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>GroupHeader[0-1]</text:p></table:table-cell><table:table-cell table:style-name="ce55" office:value-type="string" calcext:value-type="string"><text:p>@Area(.Background)</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro5"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>GroupHeader[2-4]</text:p></table:table-cell><table:table-cell table:style-name="ce55" office:value-type="string" calcext:value-type="string"><text:p>(@Area .Bold .Center) DeliveryMap.@{Delivery Boy Number}(@Area)</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>GroupHeader[5]</text:p></table:table-cell><table:table-cell table:style-name="ce55" office:value-type="string" calcext:value-type="string"><text:p>DeliveryMap.@{Delivery Boy}</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>SortBy</text:p></table:table-cell><table:table-cell table:style-name="ce55" office:value-type="string" calcext:value-type="string"><text:p>Book</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Area</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>then Sort-Ascending</text:p></table:table-cell><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@ID:Text</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Code</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="1000" calcext:value-type="float"><text:p>1000</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Name</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="7000" calcext:value-type="float"><text:p>7000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="7000" calcext:value-type="float"><text:p>7000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Mobile:Text</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p><> 0</text:p></table:table-cell><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Book:DD/MM/YY</text:p></table:table-cell><table:table-cell table:style-name="ce56" office:value-type="string" calcext:value-type="string"><text:p>< 3 days then @Book(.BadStyle)</text:p></table:table-cell><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro7"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Payment Option</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p><text:span text:style-name="T1">“Online Payment”</text:span> then @(.OnlinePayment)</text:p></table:table-cell><table:table-cell table:style-name="ce44" office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro10"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Remarks</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>then Validate-<text:span text:style-name="T2">PendingRemarksValidateList</text:span></text:p><text:p><text:span text:style-name="T2">FillSeries-Empty</text:span></text:p><text:p/></table:table-cell><table:table-cell table:style-name="ce44" office:value-type="float" office:value="2000" calcext:value-type="float"><text:p>2000</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce42" office:value-type="string" calcext:value-type="string"><text:p>[EKYC DONE IN ONLINE]</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro5"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Match</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>GetPendingOrderConsumerDetailsDateRange;EKYCPendingCustomersReportForDist</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Basic</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>SegregateEKYCDoneOnline</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Area</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>then Sort-Ascending</text:p></table:table-cell><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce42" office:value-type="string" calcext:value-type="string"><text:p>[VIP]</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Match</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>SomethingElse</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>nature.ots</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Area</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@ID</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Name</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="4000" calcext:value-type="float"><text:p>4000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="4000" calcext:value-type="float"><text:p>4000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Address</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="8000" calcext:value-type="float"><text:p>8000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="8000" calcext:value-type="float"><text:p>8000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Mobile</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="2000" calcext:value-type="float"><text:p>2000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="2000" calcext:value-type="float"><text:p>2000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Category</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Remarks</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="3000" calcext:value-type="float"><text:p>3000</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce42" office:value-type="string" calcext:value-type="string"><text:p>[DORMANT]</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Match</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>SomethingElse</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>nature.ots</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell table:style-name="ce53" office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell><table:table-cell table:style-name="ce44"/><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Area</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@ID</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Name</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="4000" calcext:value-type="float"><text:p>4000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="4000" calcext:value-type="float"><text:p>4000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Address</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="8000" calcext:value-type="float"><text:p>8000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="8000" calcext:value-type="float"><text:p>8000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Mobile</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="2000" calcext:value-type="float"><text:p>2000</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="2000" calcext:value-type="float"><text:p>2000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Block Reason</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce44" office:value-type="string" calcext:value-type="string"><text:p>@Remarks</text:p></table:table-cell><table:table-cell table:style-name="ce53"/><table:table-cell table:style-name="ce44" office:value-type="float" office:value="3000" calcext:value-type="float"><text:p>3000</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>[EKYC]</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro4"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>Match</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>EKYCPendingCustomersReportForDist</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>nature.ots</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ImportStartRow</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>1</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Area:Text</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@ID:Text</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Name:Text</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="4000" calcext:value-type="float"><text:p>4000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Address:Text</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="8000" calcext:value-type="float"><text:p>8000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Mobile:Text</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="2000" calcext:value-type="float"><text:p>2000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Consumer Type:Text</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Remarks</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="3000" calcext:value-type="float"><text:p>3000</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>[SAFETY]</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell table:style-name="ce57" office:value-type="string" calcext:value-type="string"><text:p>green_grapes.ots</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell table:style-name="ce57" office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Area</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p><text:span text:style-name="T3"><> ${OrgCode}</text:span>_PortIn</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@ID</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Names</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Address</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Mobile</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p><> 0</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Inspection Due Now</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Due Now</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Over Due</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>[TUBE]</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>pumpkin.ots</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Area</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p><text:span text:style-name="T3"><> ${OrgCode}</text:span>_PortIn</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@ID</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Names</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="4000" calcext:value-type="float"><text:p>4000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Address</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="10000" calcext:value-type="float"><text:p>10000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Mobile</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p><> 0</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Tube Change Due Now</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Over Due</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="-1" calcext:value-type="float"><text:p>-1</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>[SBC]</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>pumpkin.ots</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@ID</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Name</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="3000" calcext:value-type="float"><text:p>3000</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Address</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="8000" calcext:value-type="float"><text:p>8000</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Mobile</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Area</text:p></table:table-cell><table:table-cell/><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@No Of Cylinder</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>>= 1</text:p></table:table-cell><table:table-cell office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>[REFILL]</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>Match</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>RefillDetails</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell table:style-name="ce57" office:value-type="string" calcext:value-type="string"><text:p>green_grapes.ots</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ImportStartRow</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>1</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Type</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string" table:number-columns-spanned="1" table:number-rows-spanned="3"><text:p>Pivot-Table</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ROWS</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Operator Name</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:covered-table-cell table:style-name="Card"/><table:table-cell table:style-name="Default" office:value-type="string" calcext:value-type="string"><text:p>DATA</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>SUM(Cylinder Qty)</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:covered-table-cell table:style-name="Card"/><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>COLUMNS</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Type</text:p></table:table-cell><table:table-cell/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@ID</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Book</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Code</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Name</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="3000" calcext:value-type="float"><text:p>3000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Type</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Operator Name</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@OTP Number</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>[Export:MDB]</text:p></table:table-cell><table:table-cell table:style-name="Default" office:value-type="string" calcext:value-type="string"><text:p>fctnum</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce45" office:value-type="string" calcext:value-type="string"><text:p>@usr</text:p></table:table-cell><table:table-cell table:style-name="Default" office:value-type="string" calcext:value-type="string"><text:p>admin</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@nam</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Name</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@num</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Mobile</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@stat</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>${StateName}</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@cty</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>${CityName}</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@*</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Heading_20_1" office:value-type="string" calcext:value-type="string"><text:p>[NCTC]</text:p></table:table-cell><table:table-cell table:number-columns-repeated="3"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="ce43" office:value-type="string" calcext:value-type="string"><text:p>Match</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>NCTC</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>Theme</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>pumpkin.ots</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>ImportStartRow</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>4</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:style-name="Card" office:value-type="string" calcext:value-type="string"><text:p>GroupBy</text:p></table:table-cell><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>Area</text:p></table:table-cell><table:table-cell table:number-columns-repeated="2"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Area</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@ID</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Name</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="3000" calcext:value-type="float"><text:p>3000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Address</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="6000" calcext:value-type="float"><text:p>6000</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell office:value-type="string" calcext:value-type="string"><text:p>@Mobile</text:p></table:table-cell><table:table-cell/><table:table-cell table:number-columns-repeated="2" office:value-type="float" office:value="0" calcext:value-type="float"><text:p>0</text:p></table:table-cell></table:table-row><table:table-row table:style-name="ro1" table:number-rows-repeated="1048467"><table:table-cell table:number-columns-repeated="4"/></table:table-row><table:table-row table:style-name="ro1"><table:table-cell table:number-columns-repeated="4"/></table:table-row></table:table><table:named-expressions/></office:spreadsheet></office:body></office:document-content>+ \ No newline at end of file
diff --git a/helper.py b/helper.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +"""Pack/unpack the extracted ODS, keeping Basic modules as .bas files.""" +from pathlib import Path, PurePosixPath +import shutil +import sys +import tempfile +import xml.etree.ElementTree as ET +from xml.sax.saxutils import escape +import zipfile + +ROOT = Path(__file__).resolve().parent +ODS = ROOT / "SondageAutomation.ods" +BASIC = ROOT / "Basic" / "Standard" +ODF_DIRS = ("Basic", "Configurations2", "META-INF", "Thumbnails") +# Git cannot track the original empty ZIP directories. +EMPTY_DIRS = ("toolpanel", "accelerator", "floater", "progressbar", + "images/Bitmaps", "menubar", "popupmenu", "statusbar", "toolbar") +MODULE = ('<?xml version="1.0" encoding="UTF-8"?>\n' + '<!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">\n' + '<script:module xmlns:script="http://openoffice.org/2000/script" ' + 'script:name="{name}" script:language="StarBasic" script:moduleType="normal">' + '{code}</script:module>') + + +def pack(): + sources = sorted(BASIC.glob("*.bas")) + library = ET.parse(BASIC / "script-lb.xml").getroot() + declared = {element.get("{http://openoffice.org/2000/library}name") for element in library} + if not sources or {p.stem for p in sources} != declared: + raise ValueError(".bas files must match the Standard Basic library") + + with tempfile.NamedTemporaryFile(suffix=".ods", dir=ROOT, delete=False) as file: + tmp = Path(file.name) + try: + with zipfile.ZipFile(tmp, "w") as archive: + archive.write(ROOT / "mimetype", "mimetype", compress_type=zipfile.ZIP_STORED) + files = [p for p in ROOT.iterdir() if p.is_file() and p.suffix in (".xml", ".rdf")] + files += [p for name in ODF_DIRS for p in (ROOT / name).rglob("*") + if p.is_file() and p.suffix != ".bas"] + for path in sorted(files): + name = path.relative_to(ROOT).as_posix() + if name.startswith("Basic/Standard/") and path.with_suffix(".bas").exists(): + continue # .bas is the source, not a leftover generated XML file. + archive.write(path, name, compress_type=zipfile.ZIP_DEFLATED) + for path in sources: + archive.writestr("Basic/Standard/" + path.stem + ".xml", + MODULE.format(name=path.stem, code=escape(path.read_text(encoding="utf-8"))), + compress_type=zipfile.ZIP_DEFLATED) + for name in EMPTY_DIRS: + archive.writestr("Configurations2/" + name + "/", b"") + with zipfile.ZipFile(tmp) as archive: + assert archive.testzip() is None + assert archive.infolist()[0].filename == "mimetype" + assert archive.infolist()[0].compress_type == zipfile.ZIP_STORED + assert not archive.infolist()[0].extra + if ODS.exists(): + shutil.copy2(ODS, ODS.with_suffix(".ods.bak")) + tmp.replace(ODS) + finally: + tmp.unlink(missing_ok=True) + print(f"packed {ODS.name} from {len(sources)} Basic modules") + + +def unpack(): + with zipfile.ZipFile(ODS) as archive: + if archive.testzip() is not None: + raise ValueError("invalid workbook ZIP") + contents = {} + directories = [] + for name in archive.namelist(): + path = PurePosixPath(name) + if not path.parts or path.is_absolute() or ".." in path.parts or not ( + name == "mimetype" or path.parts[0] in ODF_DIRS + or (len(path.parts) == 1 and path.suffix in (".xml", ".rdf"))): + raise ValueError(f"unexpected workbook path: {name}") + if name.endswith("/"): + directories.append(name) + else: + data = archive.read(name) + if name.startswith("Basic/Standard/") and name.endswith(".xml") and name != "Basic/Standard/script-lb.xml": + data = (ET.fromstring(data).text or "").encode("utf-8") + name = name[:-4] + ".bas" + contents[name] = data + for name in directories: + (ROOT / name).mkdir(parents=True, exist_ok=True) + for name, data in contents.items(): + target = ROOT / name + target.parent.mkdir(parents=True, exist_ok=True) + target.write_bytes(data) + if name.startswith("Basic/Standard/") and name.endswith(".bas"): + target.with_suffix(".xml").unlink(missing_ok=True) + print(f"unpacked {len(contents)} files from {ODS.name}") + + +if __name__ == "__main__": + if len(sys.argv) != 2 or sys.argv[1] not in ("pack", "unpack"): + raise SystemExit("usage: python helper.py {pack|unpack}") + (pack if sys.argv[1] == "pack" else unpack)()
diff --git a/manifest.rdf b/manifest.rdf @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="utf-8"?> +<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> + <rdf:Description rdf:about="styles.xml"> + <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#StylesFile"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="styles.xml"/> + </rdf:Description> + <rdf:Description rdf:about="content.xml"> + <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/odf#ContentFile"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <ns0:hasPart xmlns:ns0="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#" rdf:resource="content.xml"/> + </rdf:Description> + <rdf:Description rdf:about=""> + <rdf:type rdf:resource="http://docs.oasis-open.org/ns/office/1.2/meta/pkg#Document"/> + </rdf:Description> +</rdf:RDF>
diff --git a/meta.xml b/meta.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document-meta xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:grddl="http://www.w3.org/2003/g/data-view#" office:version="1.4"><office:meta><meta:initial-creator>Hemanth Kumar</meta:initial-creator><meta:creation-date>2025-04-01T22:30:04.256000000</meta:creation-date><meta:generator>LibreOffice/26.2.6.3$Windows_X86_64 LibreOffice_project/8221e31b3ac356a1623c672912a3d2b492f7e3d1</meta:generator><dc:date>2026-10-09T09:31:13.545223500</dc:date><meta:editing-duration>P16DT5H29M47S</meta:editing-duration><meta:editing-cycles>5154</meta:editing-cycles><dc:creator>Bharatvaj</dc:creator><meta:document-statistic meta:table-count="5" meta:cell-count="404" meta:object-count="1"/></office:meta></office:document-meta>+ \ No newline at end of file
diff --git a/mimetype b/mimetype @@ -0,0 +1 @@ +application/vnd.oasis.opendocument.spreadsheet+ \ No newline at end of file
diff --git a/settings.xml b/settings.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document-settings xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" office:version="1.4"><office:settings><config:config-item-set config:name="ooo:view-settings"><config:config-item config:name="VisibleAreaTop" config:type="int">0</config:config-item><config:config-item config:name="VisibleAreaLeft" config:type="int">0</config:config-item><config:config-item config:name="VisibleAreaWidth" config:type="int">22662</config:config-item><config:config-item config:name="VisibleAreaHeight" config:type="int">17941</config:config-item><config:config-item-map-indexed config:name="Views"><config:config-item-map-entry><config:config-item config:name="ViewId" config:type="string">view1</config:config-item><config:config-item-map-named config:name="Tables"><config:config-item-map-entry config:name="FieldAliases"><config:config-item config:name="CursorPositionX" config:type="int">1</config:config-item><config:config-item config:name="CursorPositionY" config:type="int">23</config:config-item><config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item><config:config-item config:name="PositionLeft" config:type="int">0</config:config-item><config:config-item config:name="PositionRight" config:type="int">0</config:config-item><config:config-item config:name="PositionTop" config:type="int">0</config:config-item><config:config-item config:name="PositionBottom" config:type="int">11</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ZoomValue" config:type="int">140</config:config-item><config:config-item config:name="PageViewZoomValue" config:type="int">100</config:config-item><config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item><config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item><config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item><config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item><config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item><config:config-item config:name="UseTrailingEmptyLinesInLayout" config:type="boolean">false</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="FieldConfiguration"><config:config-item config:name="CursorPositionX" config:type="int">0</config:config-item><config:config-item config:name="CursorPositionY" config:type="int">9</config:config-item><config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item><config:config-item config:name="PositionLeft" config:type="int">0</config:config-item><config:config-item config:name="PositionRight" config:type="int">0</config:config-item><config:config-item config:name="PositionTop" config:type="int">0</config:config-item><config:config-item config:name="PositionBottom" config:type="int">0</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ZoomValue" config:type="int">140</config:config-item><config:config-item config:name="PageViewZoomValue" config:type="int">100</config:config-item><config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item><config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item><config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item><config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item><config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item><config:config-item config:name="UseTrailingEmptyLinesInLayout" config:type="boolean">false</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="PriceList"><config:config-item config:name="CursorPositionX" config:type="int">2</config:config-item><config:config-item config:name="CursorPositionY" config:type="int">25</config:config-item><config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item><config:config-item config:name="PositionLeft" config:type="int">0</config:config-item><config:config-item config:name="PositionRight" config:type="int">0</config:config-item><config:config-item config:name="PositionTop" config:type="int">0</config:config-item><config:config-item config:name="PositionBottom" config:type="int">1</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ZoomValue" config:type="int">140</config:config-item><config:config-item config:name="PageViewZoomValue" config:type="int">100</config:config-item><config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item><config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item><config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item><config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item><config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item><config:config-item config:name="UseTrailingEmptyLinesInLayout" config:type="boolean">false</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="Settings"><config:config-item config:name="CursorPositionX" config:type="int">1</config:config-item><config:config-item config:name="CursorPositionY" config:type="int">9</config:config-item><config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item><config:config-item config:name="PositionLeft" config:type="int">0</config:config-item><config:config-item config:name="PositionRight" config:type="int">0</config:config-item><config:config-item config:name="PositionTop" config:type="int">0</config:config-item><config:config-item config:name="PositionBottom" config:type="int">0</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ZoomValue" config:type="int">140</config:config-item><config:config-item config:name="PageViewZoomValue" config:type="int">100</config:config-item><config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item><config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item><config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item><config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item><config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item><config:config-item config:name="UseTrailingEmptyLinesInLayout" config:type="boolean">false</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="StyleDefinitions"><config:config-item config:name="CursorPositionX" config:type="int">0</config:config-item><config:config-item config:name="CursorPositionY" config:type="int">5</config:config-item><config:config-item config:name="ActiveSplitRange" config:type="short">2</config:config-item><config:config-item config:name="PositionLeft" config:type="int">0</config:config-item><config:config-item config:name="PositionRight" config:type="int">0</config:config-item><config:config-item config:name="PositionTop" config:type="int">0</config:config-item><config:config-item config:name="PositionBottom" config:type="int">0</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ZoomValue" config:type="int">140</config:config-item><config:config-item config:name="PageViewZoomValue" config:type="int">100</config:config-item><config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item><config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item><config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item><config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item><config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item><config:config-item config:name="UseTrailingEmptyLinesInLayout" config:type="boolean">false</config:config-item></config:config-item-map-entry></config:config-item-map-named><config:config-item config:name="ActiveTable" config:type="string">FieldConfiguration</config:config-item><config:config-item config:name="HorizontalScrollbarWidth" config:type="int">1189</config:config-item><config:config-item config:name="ZoomType" config:type="short">0</config:config-item><config:config-item config:name="ZoomValue" config:type="int">140</config:config-item><config:config-item config:name="PageViewZoomValue" config:type="int">100</config:config-item><config:config-item config:name="ShowPageBreakPreview" config:type="boolean">false</config:config-item><config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item><config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item><config:config-item config:name="ShowNoteAuthor" config:type="boolean">true</config:config-item><config:config-item config:name="ShowFormulasMarks" config:type="boolean">false</config:config-item><config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item><config:config-item config:name="GridColor" config:type="int">12632256</config:config-item><config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item><config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item><config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item><config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item><config:config-item config:name="IsValueHighlightingEnabled" config:type="boolean">false</config:config-item><config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item><config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item><config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item><config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item><config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item><config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item><config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item><config:config-item config:name="FormulaBarHeight" config:type="short">1</config:config-item><config:config-item config:name="WindowState" config:type="string">0,23,1600,829;4;,,,;</config:config-item><config:config-item config:name="AnchoredTextOverflowLegacy" config:type="boolean">false</config:config-item><config:config-item config:name="LegacySingleLineFontwork" config:type="boolean">false</config:config-item><config:config-item config:name="ConnectorUseSnapRect" config:type="boolean">false</config:config-item><config:config-item config:name="IgnoreBreakAfterMultilineField" config:type="boolean">false</config:config-item><config:config-item config:name="UseTrailingEmptyLinesInLayout" config:type="boolean">false</config:config-item></config:config-item-map-entry></config:config-item-map-indexed></config:config-item-set><config:config-item-set config:name="ooo:configuration-settings"><config:config-item config:name="AllowPrintJobCancel" config:type="boolean">true</config:config-item><config:config-item config:name="ApplyUserData" config:type="boolean">true</config:config-item><config:config-item config:name="AutoCalculate" config:type="boolean">true</config:config-item><config:config-item config:name="CharacterCompressionType" config:type="short">0</config:config-item><config:config-item config:name="EmbedAsianScriptFonts" config:type="boolean">true</config:config-item><config:config-item config:name="EmbedComplexScriptFonts" config:type="boolean">true</config:config-item><config:config-item config:name="EmbedFonts" config:type="boolean">false</config:config-item><config:config-item config:name="EmbedLatinScriptFonts" config:type="boolean">true</config:config-item><config:config-item config:name="EmbedOnlyUsedFonts" config:type="boolean">false</config:config-item><config:config-item-map-indexed config:name="ForbiddenCharacters"><config:config-item-map-entry><config:config-item config:name="Language" config:type="string">en</config:config-item><config:config-item config:name="Country" config:type="string">US</config:config-item><config:config-item config:name="Variant" config:type="string"/><config:config-item config:name="BeginLine" config:type="string"/><config:config-item config:name="EndLine" config:type="string"/></config:config-item-map-entry><config:config-item-map-entry><config:config-item config:name="Language" config:type="string">en</config:config-item><config:config-item config:name="Country" config:type="string">IN</config:config-item><config:config-item config:name="Variant" config:type="string"/><config:config-item config:name="BeginLine" config:type="string"/><config:config-item config:name="EndLine" config:type="string"/></config:config-item-map-entry></config:config-item-map-indexed><config:config-item config:name="GridColor" config:type="int">12632256</config:config-item><config:config-item config:name="HasColumnRowHeaders" config:type="boolean">true</config:config-item><config:config-item config:name="HasSheetTabs" config:type="boolean">true</config:config-item><config:config-item config:name="ImagePreferredDPI" config:type="int">0</config:config-item><config:config-item config:name="IsDocumentShared" config:type="boolean">false</config:config-item><config:config-item config:name="IsKernAsianPunctuation" config:type="boolean">false</config:config-item><config:config-item config:name="IsOutlineSymbolsSet" config:type="boolean">true</config:config-item><config:config-item config:name="IsRasterAxisSynchronized" config:type="boolean">true</config:config-item><config:config-item config:name="IsSnapToRaster" config:type="boolean">false</config:config-item><config:config-item config:name="LinkUpdateMode" config:type="short">3</config:config-item><config:config-item config:name="LoadReadonly" config:type="boolean">false</config:config-item><config:config-item config:name="ModifyPasswordHash" config:type="int">0</config:config-item><config:config-item config:name="PrinterName" config:type="string">NPI0E3F5B (HP LaserJet Tank MFP 1005w)</config:config-item><config:config-item config:name="PrinterPaperFromSetup" config:type="boolean">false</config:config-item><config:config-item config:name="PrinterSetup" config:type="base64Binary">BzP+/05QSTBFM0Y1QiAoSFAgTGFzZXJKZXQgVGFuayBNRlAgMTAwNXcpAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAASFAgTGFzZXJKZXQgVGFuayBNRlAgMTAwNSBQQ0xtLQAWAAEAvjEAAAAAAAAIAFZUAAAkbQAAM1ROVwAAAAAKAE4AUABJADAARQAzAEYANQBCACAAKABIAFAAIABMAGEAcwBlAHIASgBlAHQAIABUAGEAbgBrACAATQBGAAAAAAABBAMG3ADYMEO/AQIBAAEA6gpvCGQAAQAPAFgCAQABAFgCAwABAEwAZQB0AHQAZQByAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAQAAAAIAAAABAQAA/////0dJUzQAAAAAAAAAAAAAAABESU5VIgCwAwwGzCqJ14J1AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAsAMAAFNNVEoAAAAAEACgA3sARQAzADIANgBCADYAMwAzAC0AMABDAEUAOQAtADQARQAxAEUALQBCADcARgBCAC0ARABCADUAQQAyAEMANQA4AEEARgBCADYAfQAAAElucHV0QmluAEZPUk1TT1VSQ0UAUkVTRExMAFVuaXJlc0RMTABMb2NhbGUARW5nbGlzaF9Vbml0ZWRfU3RhdGVzAFN0cmluZ3NDbHVzdGVyMABJRFNfUFNfU05BUFBIT1RPUwBTdHJpbmdzQ2x1c3RlcjEASURTX0FCT1VUX0hQX0NPUFlSSUdIVDEASFBGZWVkVHlwZQBIUENGZWVkAER1cGxleABOT05FAF9HZW5lcmFsRXZlcnlkYXkATWVkaWFUeXBlAF9lbnZlbG9wZV80OABNZWRpYVR5cGUAX2xhYmVscwBNZWRpYVR5cGUAX0ZhY3RvcnlEZWZhdWx0cwBNZWRpYVR5cGUAUFNfRUNPU01BUlRfU0VUVElOR1MATWVkaWFUeXBlAFBhcGVyU2l6ZQBMRVRURVIAT3JpZW50YXRpb24AUE9SVFJBSVQATWVkaWFUeXBlAFVOU1BFQ0lGSUVEAFVzZXJSZXNvbHV0aW9uAE5vcm1hbABWNERyaXZlcgBWNABIUElua0RyaXZlclR5cGUASFBTdGFuZGFyZElua0RyaXZlcgBEZXZpY2VMYW5ndWFnZQBQQ0xtUwBNb2RlbE5hbWUAU3RhcnMASFBCb29rbGV0R3V0dGVyADg2MzYATWFudWFsRHVwbGV4AE1hbnVhbABEUEMARkxBVEVPTkxZAFFGADgwAENvbG9yTW9kZQBPZmYASm9iUGFnZU9yZGVyAFN0YW5kYXJkAERvY3VtZW50TlVwADEARG9jdW1lbnRCaW5kaW5nAE5vbmUAUHJlc2VudGF0aW9uRGlyZWN0aW9uAFJpZ2h0Qm90dG9tAEJpZ0RhdGEAT04AUmVzb2x1dGlvbgA2MDB4NjAwAE5VcEJvcmRlcnMAT2ZmAEhQUHJpbnRPbkJvdGhTaWRlc01hbnVhbGx5AE9OAENvbGxhdGUAT04AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADMKgAAVjRETQEAAAAAAAAAeqmwchwAAACUDgAAPgAAADO2JuPpDB5Ot/vbWixYr7Z4DgAA/AMAAAQAAACAAAAAAAAAAAAAAAABAAAABAAAAA4AAACAAAAAAQAAAAQAAAAYAAAAhAAAAAEAAAAEAAAAJgAAAIgAAAABAAAABAAAAEQAAACMAAAAAQAAAAQAAABkAAAAkAAAAAMAAAB+AAAAjAAAAJQAAAABAAAABAAAALQAAAAUAQAAAQAAAAQAAADmAAAAGAEAAAMAAAB+AAAAGgEAABwBAAADAAAAfgAAAEIBAACcAQAAAwAAAH4AAABoAQAAHAIAAAEAAAAEAAAAjgEAAJwCAAABAAAABAAAAL4BAACgAgAAAwAAAH4AAADwAQAApAIAAAMAAAB+AAAAFgIAACQDAAADAAAAfgAAADoCAACkAwAAAQAAAAQAAABkAgAAJAQAAAEAAAAEAAAAmAIAACgEAAADAAAAfgAAAM4CAAAsBAAAAwAAAH4AAAD4AgAArAQAAAMAAAB+AAAAIAMAACwFAAABAAAABAAAAFQDAACsBQAAAQAAAAQAAACSAwAAsAUAAAMAAAB+AAAA0gMAALQFAAADAAAAfgAAAAYEAAA0BgAAAwAAAH4AAAA4BAAAtAYAAAMAAAAAAQAAdgQAADQHAAADAAAAfgAAAKAEAAA0CAAAAQAAAAQAAADUBAAAtAgAAAEAAAAEAAAAEgUAALgIAAADAAAAfgAAAFIFAAC8CAAAAwAAAH4AAACGBQAAPAkAAAMAAAB+AAAAuAUAALwJAAADAAAAAAEAAPYFAAA8CgAAAwAAAAABAAAgBgAAPAsAAAEAAAAEAAAAQAYAADwMAAABAAAABAAAAGoGAABADAAAAQAAAAQAAACWBgAARAwAAAEAAAAEAAAAsgYAAEgMAAADAAAAAAIAANAGAABMDAAAAQAAAAQAAAD2BgAATA4AAAEAAAAEAAAAOgcAAFAOAAABAAAABAAAAIAHAABUDgAAAwAAAAACAAC0BwAAWA4AAAEAAAAEAAAA4gcAAFgQAAABAAAABAAAABYIAABcEAAAAwAAABIAAABECAAAYBAAAAMAAAAAAQAAcggAAHQQAAABAAAABAAAAKAIAAB0EQAAAQAAAAQAAADSCAAAeBEAAAEAAAAEAAAA/ggAAHwRAAABAAAABAAAAC4JAACAEQAAAwAAADAIAABoCQAAhBEAAAEAAAAEAAAAmAkAALQZAAABAAAABAAAANIJAAC4GQAAAwAAAIAAAAAOCgAAvBkAAAMAAACAAAAAHgoAADwaAAADAAAAGgAAADAKAAC8GgAAAwAAAAABAAA4CgAA2BoAAAMAAABAAAAASgoAANgbAAADAAAAIAAAAGQKAAAYHAAAYgBBAHIAcgBhAHkAAABaAG8AbwBtAAAAUABvAHMAdABlAHIAAABOAFUAcABCAG8AcgBkAGUAcgBXAGkAZAB0AGgAAABOAFUAcABCAG8AcgBkAGUAcgBMAGUAbgBnAHQAaAAAAE4AVQBwAEIAbwByAGQAZQByAEQAYQBzAGgATABlAG4AZwB0AGgAAABGAHIAbwBuAHQAQwBvAHYAZQByAE0AZQBkAGkAYQBTAGkAegBlAAAARgByAG8AbgB0AEMAbwB2AGUAcgBNAGUAZABpAGEAUwBpAHoAZQBXAGkAZAB0AGgAAABGAHIAbwBuAHQAQwBvAHYAZQByAE0AZQBkAGkAYQBTAGkAegBlAEgAZQBpAGcAaAB0AAAARgByAG8AbgB0AEMAbwB2AGUAcgBNAGUAZABpAGEAVAB5AHAAZQAAAEYAcgBvAG4AdABDAG8AdgBlAHIASQBuAHAAdQB0AEIAaQBuAAAAQgBhAGMAawBDAG8AdgBlAHIATQBlAGQAaQBhAFMAaQB6AGUAAABCAGEAYwBrAEMAbwB2AGUAcgBNAGUAZABpAGEAUwBpAHoAZQBXAGkAZAB0AGgAAABCAGEAYwBrAEMAbwB2AGUAcgBNAGUAZABpAGEAUwBpAHoAZQBIAGUAaQBnAGgAdAAAAEIAYQBjAGsAQwBvAHYAZQByAE0AZQBkAGkAYQBUAHkAcABlAAAAQgBhAGMAawBDAG8AdgBlAHIASQBuAHAAdQB0AEIAaQBuAAAASQBuAHQAZQByAGwAZQBhAHYAZQBzAE0AZQBkAGkAYQBTAGkAegBlAAAASQBuAHQAZQByAGwAZQBhAHYAZQBzAE0AZQBkAGkAYQBTAGkAegBlAFcAaQBkAHQAaAAAAEkAbgB0AGUAcgBsAGUAYQB2AGUAcwBNAGUAZABpAGEAUwBpAHoAZQBIAGUAaQBnAGgAdAAAAEkAbgB0AGUAcgBsAGUAYQB2AGUAcwBNAGUAZABpAGEAVAB5AHAAZQAAAEkAbgB0AGUAcgBsAGUAYQB2AGUAcwBJAG4AcAB1AHQAQgBpAG4AAABJAG4AcwBlAHIAdABFAG0AcAB0AHkAUABhAGcAZQBzAE0AZQBkAGkAYQBTAGkAegBlAAAASQBuAHMAZQByAHQARQBtAHAAdAB5AFAAYQBnAGUAcwBNAGUAZABpAGEAUwBpAHoAZQBXAGkAZAB0AGgAAABJAG4AcwBlAHIAdABFAG0AcAB0AHkAUABhAGcAZQBzAE0AZQBkAGkAYQBTAGkAegBlAEgAZQBpAGcAaAB0AAAASQBuAHMAZQByAHQARQBtAHAAdAB5AFAAYQBnAGUAcwBNAGUAZABpAGEAVAB5AHAAZQAAAEkAbgBzAGUAcgB0AEUAbQBwAHQAeQBQAGEAZwBlAHMASQBuAHAAdQB0AEIAaQBuAAAASQBuAHMAZQByAHQARQBtAHAAdAB5AFAAYQBnAGUAcwBFAHgAYwBlAHAAdABpAG8AbgBVAHMAYQBnAGUAAABJAG4AcwBlAHIAdABFAG0AcAB0AHkAUABhAGcAZQBzAEwAaQBzAHQAAABJAG4AcwBlAHIAdABQAHIAaQBuAHQAUABhAGcAZQBzAE0AZQBkAGkAYQBTAGkAegBlAAAASQBuAHMAZQByAHQAUAByAGkAbgB0AFAAYQBnAGUAcwBNAGUAZABpAGEAUwBpAHoAZQBXAGkAZAB0AGgAAABJAG4AcwBlAHIAdABQAHIAaQBuAHQAUABhAGcAZQBzAE0AZQBkAGkAYQBTAGkAegBlAEgAZQBpAGcAaAB0AAAASQBuAHMAZQByAHQAUAByAGkAbgB0AFAAYQBnAGUAcwBNAGUAZABpAGEAVAB5AHAAZQAAAEkAbgBzAGUAcgB0AFAAcgBpAG4AdABQAGEAZwBlAHMASQBuAHAAdQB0AEIAaQBuAAAASQBuAHMAZQByAHQAUAByAGkAbgB0AFAAYQBnAGUAcwBFAHgAYwBlAHAAdABpAG8AbgBVAHMAYQBnAGUAAABJAG4AcwBlAHIAdABQAHIAaQBuAHQAUABhAGcAZQBzAEwAaQBzAHQAAABUAGEAcgBnAGUAdABNAGUAZABpAGEAUwBpAHoAZQAAAFQAYQByAGcAZQB0AE0AZQBkAGkAYQBTAGkAegBlAFcAaQBkAHQAaAAAAFQAYQByAGcAZQB0AE0AZQBkAGkAYQBTAGkAegBlAEgAZQBpAGcAaAB0AAAAQgBpAG4AZABpAG4AZwBHAHUAdAB0AGUAcgAAAFMAaQBnAG4AYQB0AHUAcgBlAFAAYQBnAGUAcwAAAFAAYQBnAGUAVwBhAHQAZQByAG0AYQByAGsATgBhAG0AZQBIAAAAUABhAGcAZQBXAGEAdABlAHIAbQBhAHIAawBQAGwAYQBjAGUAbQBlAG4AdABPAGYAZgBzAGUAdABXAGkAZAB0AGgAAABQAGEAZwBlAFcAYQB0AGUAcgBtAGEAcgBrAFAAbABhAGMAZQBtAGUAbgB0AE8AZgBmAHMAZQB0AEgAZQBpAGcAaAB0AAAAUABhAGcAZQBXAGEAdABlAHIAbQBhAHIAawBUAHIAYQBuAHMAcABhAHIAZQBuAGMAeQAAAFAAYQBnAGUAVwBhAHQAZQByAG0AYQByAGsAVABlAHgAdABUAGUAeAB0AEgAAABQAGEAZwBlAFcAYQB0AGUAcgBtAGEAcgBrAFQAZQB4AHQARgBvAG4AdABTAGkAegBlAAAAUABhAGcAZQBXAGEAdABlAHIAbQBhAHIAawBUAGUAeAB0AEEAbgBnAGwAZQAAAFAAYQBnAGUAVwBhAHQAZQByAG0AYQByAGsAVABlAHgAdABDAG8AbABvAHIAAABQAGEAZwBlAFcAYQB0AGUAcgBtAGEAcgBrAFQAZQB4AHQARgBvAG4AdABIAAAAUABhAGcAZQBXAGEAdABlAHIAbQBhAHIAawBUAGUAeAB0AE8AdQB0AGwAaQBuAGUAAABQAGEAZwBlAFcAYQB0AGUAcgBtAGEAcgBrAFQAZQB4AHQAQgBvAGwAZAAAAFAAYQBnAGUAVwBhAHQAZQByAG0AYQByAGsAVABlAHgAdABJAHQAYQBsAGkAYwAAAFAAYQBnAGUAVwBhAHQAZQByAG0AYQByAGsAVABlAHgAdABSAGkAZwBoAHQAVABvAEwAZQBmAHQAAABQAGEAZwBlAFcAYQB0AGUAcgBtAGEAcgBrAEkAbQBhAGcAZQBGAGkAbABlAEgAAABQAGEAZwBlAFcAYQB0AGUAcgBtAGEAcgBrAEkAbQBhAGcAZQBTAGMAYQBsAGUAVwBpAGQAdABoAAAAUABhAGcAZQBXAGEAdABlAHIAbQBhAHIAawBJAG0AYQBnAGUAUwBjAGEAbABlAEgAZQBpAGcAaAB0AAAASgBvAGIATgBhAG0AZQAAAFUAcwBlAHIATgBhAG0AZQAAAFAASQBOAAAAUABhAHMAcwB3AG8AcgBkAAAAUwBoAG8AcgB0AGMAdQB0AE4AYQBtAGUAAABEAHUAcABsAGUAeABNAG8AZABlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGQAAAABAAAAAAAAAAAAAAAAAAAAbgBzADAAMAAwADAAOgBVAHMAZQBQAGEAZwBlAE0AZQBkAGkAYQBTAGkAegBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcwBrADoAUABsAGEAaQBuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABzAGsAOgBBAHUAdABvAFMAZQBsAGUAYwB0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABuAHMAMAAwADAAMAA6AFUAcwBlAFAAYQBnAGUATQBlAGQAaQBhAFMAaQB6AGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABzAGsAOgBQAGwAYQBpAG4AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHMAawA6AEEAdQB0AG8AUwBlAGwAZQBjAHQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG4AcwAwADAAMAAwADoAVQBzAGUAUABhAGcAZQBNAGUAZABpAGEAUwBpAHoAZQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHMAawA6AFAAbABhAGkAbgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcwBrADoAQQB1AHQAbwBTAGUAbABlAGMAdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAbgBzADAAMAAwADAAOgBVAHMAZQBQAGEAZwBlAE0AZQBkAGkAYQBTAGkAegBlAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHAAcwBrADoAQQB1AHQAbwBTAGUAbABlAGMAdAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABzAGsAOgBBAHUAdABvAFMAZQBsAGUAYwB0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABuAHMAMAAwADAAMAA6AFMAcABlAGMAaQBmAGkAZQBkAFAAYQBnAGUAcwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABuAHMAMAAwADAAMAA6AFUAcwBlAFAAYQBnAGUATQBlAGQAaQBhAFMAaQB6AGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAcABzAGsAOgBBAHUAdABvAFMAZQBsAGUAYwB0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABwAHMAawA6AEEAdQB0AG8AUwBlAGwAZQBjAHQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAG4AcwAwADAAMAAwADoAUwBwAGUAYwBpAGYAaQBlAGQAUABhAGcAZQBzAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADIAAAAwADAANgAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEgAAAAAAAAARgBGAEYARgAwADAAMAAwAAAAAAAwADAANgAxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAAMAA0ADEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAZAAAAGQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATQBhAG4AdQBhAGwAAAAAAAAAAAAAAAAAAAAAAAAAAAASAENPTVBBVF9EVVBMRVhfTU9ERQ8ARHVwbGV4TW9kZTo6T2ZmDABQUklOVEVSX05BTUUmAE5QSTBFM0Y1QiAoSFAgTGFzZXJKZXQgVGFuayBNRlAgMTAwNXcpCwBEUklWRVJfTkFNRSUASFAgTGFzZXJKZXQgVGFuayBNRlAgMTAwNSBQQ0xtLVMgKFY0KQ==</config:config-item><config:config-item config:name="RasterIsVisible" config:type="boolean">false</config:config-item><config:config-item config:name="RasterResolutionX" config:type="int">1000</config:config-item><config:config-item config:name="RasterResolutionY" config:type="int">1000</config:config-item><config:config-item config:name="RasterSubdivisionX" config:type="int">1</config:config-item><config:config-item config:name="RasterSubdivisionY" config:type="int">1</config:config-item><config:config-item config:name="SaveThumbnail" config:type="boolean">true</config:config-item><config:config-item config:name="SaveVersionOnClose" config:type="boolean">false</config:config-item><config:config-item config:name="ShowFormulasMarks" config:type="boolean">false</config:config-item><config:config-item config:name="ShowGrid" config:type="boolean">true</config:config-item><config:config-item config:name="ShowNoteAuthor" config:type="boolean">true</config:config-item><config:config-item config:name="ShowNotes" config:type="boolean">true</config:config-item><config:config-item config:name="ShowPageBreaks" config:type="boolean">true</config:config-item><config:config-item config:name="ShowZeroValues" config:type="boolean">true</config:config-item><config:config-item config:name="SyntaxStringRef" config:type="short">7</config:config-item><config:config-item config:name="UpdateFromTemplate" config:type="boolean">true</config:config-item><config:config-item-map-named config:name="ScriptConfiguration"><config:config-item-map-entry config:name="Settings"><config:config-item config:name="CodeName" config:type="string">Sheet1</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="PriceList"><config:config-item config:name="CodeName" config:type="string">Sheet2</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="FieldAliases"><config:config-item config:name="CodeName" config:type="string">Sheet5</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="StyleDefinitions"><config:config-item config:name="CodeName" config:type="string">Sheet5</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="FieldConfiguration"><config:config-item config:name="CodeName" config:type="string">Sheet6</config:config-item></config:config-item-map-entry></config:config-item-map-named></config:config-item-set></office:settings></office:document-settings>+ \ No newline at end of file
diff --git a/styles.xml b/styles.xml @@ -0,0 +1,2 @@ +<?xml version="1.0" encoding="UTF-8"?> +<office:document-styles xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" office:version="1.4"><office:font-face-decls><style:font-face style:name="HG Mincho Light J" svg:font-family="'HG Mincho Light J'" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans" svg:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans Unicode MS" svg:font-family="'Liberation Sans Unicode MS'" style:font-pitch="variable"/><style:font-face style:name="Liberation Sans1" svg:font-family="'Liberation Sans'" style:font-adornments="Fett" style:font-family-generic="swiss" style:font-pitch="variable"/><style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-adornments="Negrito" style:font-family-generic="roman" style:font-pitch="variable"/><style:font-face style:name="Lucida Sans" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/><style:font-face style:name="Microsoft YaHei" svg:font-family="'Microsoft YaHei'" style:font-family-generic="system" style:font-pitch="variable"/></office:font-face-decls><office:styles><style:default-style style:family="table-cell"><style:paragraph-properties style:tab-stop-distance="7.62cm"/><style:text-properties style:font-name="Liberation Sans" fo:font-size="10pt" fo:language="en" fo:country="IN" style:font-name-asian="Microsoft YaHei" style:font-size-asian="10pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans" style:font-size-complex="10pt" style:language-complex="hi" style:country-complex="IN"/></style:default-style><style:default-style style:family="graphic"><style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" style:writing-mode="page"/><style:paragraph-properties style:text-autospace="ideograph-alpha" style:punctuation-wrap="simple" style:line-break="strict" loext:tab-stop-distance="0cm" style:font-independent-line-spacing="false"><style:tab-stops/></style:paragraph-properties><style:text-properties style:use-window-font-color="true" loext:opacity="0%" fo:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="12pt" fo:language="en" fo:country="IN" style:letter-kerning="true" style:font-family-asian="'Segoe UI'" style:font-family-generic-asian="system" style:font-pitch-asian="variable" style:font-size-asian="12pt" style:language-asian="zh" style:country-asian="CN" style:font-family-complex="Tahoma" style:font-family-generic-complex="system" style:font-pitch-complex="variable" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/></style:default-style><style:style style:name="Default" style:family="graphic"/><style:style style:name="Note" style:family="graphic" style:parent-style-name="Default"><style:graphic-properties draw:stroke="solid" draw:marker-start="Arrowheads_20_1" draw:marker-start-width="0.2cm" draw:marker-start-center="false" draw:fill="solid" draw:fill-color="#ffffc0" draw:auto-grow-height="true" draw:auto-grow-width="false" fo:padding-top="0.1cm" fo:padding-bottom="0.1cm" fo:padding-left="0.1cm" fo:padding-right="0.1cm" draw:shadow="visible" draw:shadow-offset-x="0.1cm" draw:shadow-offset-y="0.1cm"/><style:text-properties style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="10pt" style:font-name-asian="HG Mincho Light J" style:font-family-asian="'HG Mincho Light J'" style:font-pitch-asian="variable" style:font-size-asian="10pt" style:font-name-complex="Liberation Sans Unicode MS" style:font-family-complex="'Liberation Sans Unicode MS'" style:font-pitch-complex="variable" style:font-size-complex="10pt"/></style:style><number:number-style style:name="N0"><number:number number:min-integer-digits="1"/></number:number-style><number:text-style style:name="N100"><number:text-content/></number:text-style><number:number-style style:name="N120P0" style:volatile="true"><number:text>₹ </number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/></number:number-style><number:number-style style:name="N120"><number:text>₹ -</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><style:map style:condition="value()>=0" style:apply-style-name="N120P0"/></number:number-style><number:number-style style:name="N121P0" style:volatile="true"><number:text>₹ </number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/></number:number-style><number:number-style style:name="N121"><style:text-properties fo:color="#ff0000"/><number:text>₹ -</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><style:map style:condition="value()>=0" style:apply-style-name="N121P0"/></number:number-style><number:number-style style:name="N123P0" style:volatile="true"><number:text>₹ </number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/></number:number-style><number:number-style style:name="N123"><number:text>₹ -</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><style:map style:condition="value()>=0" style:apply-style-name="N123P0"/></number:number-style><number:number-style style:name="N124P0" style:volatile="true"><number:text>₹ </number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/></number:number-style><number:number-style style:name="N124"><style:text-properties fo:color="#ff0000"/><number:text>₹ -</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><style:map style:condition="value()>=0" style:apply-style-name="N124P0"/></number:number-style><number:number-style style:name="N125P0" style:volatile="true"><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/></number:number-style><number:number-style style:name="N125"><number:text>-</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><style:map style:condition="value()>=0" style:apply-style-name="N125P0"/></number:number-style><number:number-style style:name="N126P0" style:volatile="true"><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/></number:number-style><number:number-style style:name="N126"><style:text-properties fo:color="#ff0000"/><number:text>-</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><style:map style:condition="value()>=0" style:apply-style-name="N126P0"/></number:number-style><number:number-style style:name="N127P0" style:volatile="true"><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/></number:number-style><number:number-style style:name="N127"><number:text>-</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><style:map style:condition="value()>=0" style:apply-style-name="N127P0"/></number:number-style><number:number-style style:name="N128P0" style:volatile="true"><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/></number:number-style><number:number-style style:name="N128"><style:text-properties fo:color="#ff0000"/><number:text>-</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><style:map style:condition="value()>=0" style:apply-style-name="N128P0"/></number:number-style><number:number-style style:name="N132P0" style:volatile="true"><number:text loext:blank-width-char=" "> </number:text><number:fill-character> </number:fill-character><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:number-style style:name="N132P1" style:volatile="true"><number:text loext:blank-width-char=" "> </number:text><number:fill-character> </number:fill-character><number:text>-</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:number-style style:name="N132P2" style:volatile="true"><number:text loext:blank-width-char=" "> </number:text><number:fill-character> </number:fill-character><number:text>- _ </number:text></number:number-style><number:text-style style:name="N132"><number:text loext:blank-width-char=" "> </number:text><number:text-content/><number:text loext:blank-width-char=" "> </number:text><style:map style:condition="value()>0" style:apply-style-name="N132P0"/><style:map style:condition="value()<0" style:apply-style-name="N132P1"/><style:map style:condition="value()=0" style:apply-style-name="N132P2"/></number:text-style><number:number-style style:name="N136P0" style:volatile="true"><number:text loext:blank-width-char=" "> ₹ </number:text><number:fill-character> </number:fill-character><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:number-style style:name="N136P1" style:volatile="true"><number:text loext:blank-width-char=" "> ₹ </number:text><number:fill-character> </number:fill-character><number:text>-</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:number-style style:name="N136P2" style:volatile="true"><number:text loext:blank-width-char=" "> ₹ </number:text><number:fill-character> </number:fill-character><number:text>- _ </number:text></number:number-style><number:text-style style:name="N136"><number:text loext:blank-width-char=" "> </number:text><number:text-content/><number:text loext:blank-width-char=" "> </number:text><style:map style:condition="value()>0" style:apply-style-name="N136P0"/><style:map style:condition="value()<0" style:apply-style-name="N136P1"/><style:map style:condition="value()=0" style:apply-style-name="N136P2"/></number:text-style><number:number-style style:name="N140P0" style:volatile="true"><number:text loext:blank-width-char=" "> </number:text><number:fill-character> </number:fill-character><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:number-style style:name="N140P1" style:volatile="true"><number:text loext:blank-width-char=" "> </number:text><number:fill-character> </number:fill-character><number:text>-</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:number-style style:name="N140P2" style:volatile="true"><number:text loext:blank-width-char=" "> </number:text><number:fill-character> </number:fill-character><number:text>-</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="2" loext:max-blank-integer-digits="2"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:text-style style:name="N140"><number:text loext:blank-width-char=" "> </number:text><number:text-content/><number:text loext:blank-width-char=" "> </number:text><style:map style:condition="value()>0" style:apply-style-name="N140P0"/><style:map style:condition="value()<0" style:apply-style-name="N140P1"/><style:map style:condition="value()=0" style:apply-style-name="N140P2"/></number:text-style><number:number-style style:name="N144P0" style:volatile="true"><number:text loext:blank-width-char=" "> ₹ </number:text><number:fill-character> </number:fill-character><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:number-style style:name="N144P1" style:volatile="true"><number:text loext:blank-width-char=" "> ₹ </number:text><number:fill-character> </number:fill-character><number:text>-</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:number-style style:name="N144P2" style:volatile="true"><number:text loext:blank-width-char=" "> ₹ </number:text><number:fill-character> </number:fill-character><number:text>-</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="2" loext:max-blank-integer-digits="2"/><number:text loext:blank-width-char=" "> </number:text></number:number-style><number:text-style style:name="N144"><number:text loext:blank-width-char=" "> </number:text><number:text-content/><number:text loext:blank-width-char=" "> </number:text><style:map style:condition="value()>0" style:apply-style-name="N144P0"/><style:map style:condition="value()<0" style:apply-style-name="N144P1"/><style:map style:condition="value()=0" style:apply-style-name="N144P2"/></number:text-style><number:time-style style:name="N145"><number:minutes number:style="long"/><number:text>:</number:text><number:seconds number:style="long"/></number:time-style><number:time-style style:name="N146" number:truncate-on-overflow="false"><number:hours/><number:text>:</number:text><number:minutes number:style="long"/><number:text>:</number:text><number:seconds number:style="long"/></number:time-style><number:time-style style:name="N147"><number:minutes number:style="long"/><number:text>:</number:text><number:seconds number:style="long" number:decimal-places="1"/></number:time-style><number:number-style style:name="N148"><number:scientific-number number:decimal-places="1" number:min-decimal-places="1" number:min-integer-digits="1" number:min-exponent-digits="1" number:exponent-interval="3" number:forced-exponent-sign="true"/></number:number-style><number:number-style style:name="N150P0" style:volatile="true"><number:text>$</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:number-style style:name="N150"><number:text>($</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text>)</number:text><style:map style:condition="value()>=0" style:apply-style-name="N150P0"/></number:number-style><number:number-style style:name="N151P0" style:volatile="true"><number:text>$</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:number-style style:name="N151"><style:text-properties fo:color="#ff0000"/><number:text>($</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text>)</number:text><style:map style:condition="value()>=0" style:apply-style-name="N151P0"/></number:number-style><number:number-style style:name="N153P0" style:volatile="true"><number:text>$</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:number-style style:name="N153"><number:text>($</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text>)</number:text><style:map style:condition="value()>=0" style:apply-style-name="N153P0"/></number:number-style><number:number-style style:name="N154P0" style:volatile="true"><number:text>$</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:number-style style:name="N154"><style:text-properties fo:color="#ff0000"/><number:text>($</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text>)</number:text><style:map style:condition="value()>=0" style:apply-style-name="N154P0"/></number:number-style><number:date-style style:name="N155"><number:day-of-week number:style="long"/><number:text>, </number:text><number:month number:style="long" number:textual="true"/><number:text> </number:text><number:day number:style="long"/><number:text>, </number:text><number:year number:style="long"/></number:date-style><number:number-style style:name="N159P0" style:volatile="true"><number:text loext:blank-width-char="("> </number:text><number:fill-character> </number:fill-character><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:number-style style:name="N159P1" style:volatile="true"><number:text loext:blank-width-char="("> </number:text><number:fill-character> </number:fill-character><number:text>(</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text>)</number:text></number:number-style><number:number-style style:name="N159P2" style:volatile="true"><number:text loext:blank-width-char="("> </number:text><number:fill-character> </number:fill-character><number:text>- _)</number:text></number:number-style><number:text-style style:name="N159"><number:text loext:blank-width-char="("> </number:text><number:text-content/><number:text loext:blank-width-char=")"> </number:text><style:map style:condition="value()>0" style:apply-style-name="N159P0"/><style:map style:condition="value()<0" style:apply-style-name="N159P1"/><style:map style:condition="value()=0" style:apply-style-name="N159P2"/></number:text-style><number:number-style style:name="N163P0" style:volatile="true"><number:text loext:blank-width-char="("> $</number:text><number:fill-character> </number:fill-character><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:number-style style:name="N163P1" style:volatile="true"><number:text loext:blank-width-char="("> $</number:text><number:fill-character> </number:fill-character><number:text>(</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="1" number:grouping="true"/><number:text>)</number:text></number:number-style><number:number-style style:name="N163P2" style:volatile="true"><number:text loext:blank-width-char="("> $</number:text><number:fill-character> </number:fill-character><number:text>- _)</number:text></number:number-style><number:text-style style:name="N163"><number:text loext:blank-width-char="("> </number:text><number:text-content/><number:text loext:blank-width-char=")"> </number:text><style:map style:condition="value()>0" style:apply-style-name="N163P0"/><style:map style:condition="value()<0" style:apply-style-name="N163P1"/><style:map style:condition="value()=0" style:apply-style-name="N163P2"/></number:text-style><number:number-style style:name="N167P0" style:volatile="true"><number:text loext:blank-width-char="("> </number:text><number:fill-character> </number:fill-character><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:number-style style:name="N167P1" style:volatile="true"><number:text loext:blank-width-char="("> </number:text><number:fill-character> </number:fill-character><number:text>(</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text>)</number:text></number:number-style><number:number-style style:name="N167P2" style:volatile="true"><number:text loext:blank-width-char="("> </number:text><number:fill-character> </number:fill-character><number:text>-</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="2" loext:max-blank-integer-digits="2"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:text-style style:name="N167"><number:text loext:blank-width-char="("> </number:text><number:text-content/><number:text loext:blank-width-char=")"> </number:text><style:map style:condition="value()>0" style:apply-style-name="N167P0"/><style:map style:condition="value()<0" style:apply-style-name="N167P1"/><style:map style:condition="value()=0" style:apply-style-name="N167P2"/></number:text-style><number:number-style style:name="N171P0" style:volatile="true"><number:text loext:blank-width-char="("> $</number:text><number:fill-character> </number:fill-character><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:number-style style:name="N171P1" style:volatile="true"><number:text loext:blank-width-char="("> $</number:text><number:fill-character> </number:fill-character><number:text>(</number:text><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1" number:grouping="true"/><number:text>)</number:text></number:number-style><number:number-style style:name="N171P2" style:volatile="true"><number:text loext:blank-width-char="("> $</number:text><number:fill-character> </number:fill-character><number:text>-</number:text><number:number number:decimal-places="0" number:min-decimal-places="0" number:min-integer-digits="2" loext:max-blank-integer-digits="2"/><number:text loext:blank-width-char=")"> </number:text></number:number-style><number:text-style style:name="N171"><number:text loext:blank-width-char="("> </number:text><number:text-content/><number:text loext:blank-width-char=")"> </number:text><style:map style:condition="value()>0" style:apply-style-name="N171P0"/><style:map style:condition="value()<0" style:apply-style-name="N171P1"/><style:map style:condition="value()=0" style:apply-style-name="N171P2"/></number:text-style><number:date-style style:name="N172"><number:day number:style="long"/><number:text>/</number:text><number:month number:style="long"/></number:date-style><style:style style:name="Default" style:family="table-cell" style:data-style-name="N0"><style:table-cell-properties style:text-align-source="value-type" style:repeat-content="false" style:vertical-align="middle"/><style:text-properties style:font-name="Liberation Sans" fo:font-family="'Liberation Sans'" style:font-family-generic="swiss" style:font-pitch="variable"/></style:style><style:style style:name="Heading" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:background-color="#63639c" style:text-align-source="fix" style:repeat-content="false" fo:border="0.06pt solid #000080"/><style:paragraph-properties fo:text-align="center"/><style:text-properties fo:color="#e6e6e6" style:font-name="Liberation Serif" fo:font-family="'Liberation Serif'" style:font-style-name="Negrito" style:font-family-generic="roman" style:font-pitch="variable" fo:font-size="18pt" fo:font-style="normal" fo:font-weight="bold"/></style:style><style:style style:name="Heading_20_1" style:display-name="Heading 1" style:family="table-cell" style:parent-style-name="Heading"><style:table-cell-properties fo:background-color="#cfcfff"/><style:text-properties fo:color="#000030" style:font-name="Liberation Sans1" fo:font-family="'Liberation Sans'" style:font-style-name="Fett" style:font-family-generic="swiss" style:font-pitch="variable" fo:font-size="10pt"/></style:style><style:style style:name="Heading_20_2" style:display-name="Heading 2" style:family="table-cell" style:parent-style-name="Heading"><style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:font-size="12pt" style:font-size-asian="12pt" style:font-size-complex="12pt"/></style:style><style:style style:name="Text" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/></style:style><style:style style:name="Note" style:family="table-cell" style:parent-style-name="Text"><style:table-cell-properties fo:background-color="#ffffcc" style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:wrap-option="no-wrap" fo:border="0.74pt solid #808080" style:shrink-to-fit="false"/><style:text-properties fo:color="#333333"/></style:style><style:style style:name="Footnote" style:family="table-cell" style:parent-style-name="Text"><style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#808080" fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"/></style:style><style:style style:name="Hyperlink" style:family="table-cell" style:parent-style-name="Text"><style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#0000ee" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="#0000ee"/></style:style><style:style style:name="Status" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/></style:style><style:style style:name="Good" style:family="table-cell" style:parent-style-name="Status"><style:table-cell-properties fo:background-color="#ccffcc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#006600"/></style:style><style:style style:name="Neutral" style:family="table-cell" style:parent-style-name="Status"><style:table-cell-properties fo:background-color="#ffffcc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#996600"/></style:style><style:style style:name="Bad" style:family="table-cell" style:parent-style-name="Status"><style:table-cell-properties fo:background-color="#ffcccc" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#cc0000"/></style:style><style:style style:name="Warning" style:family="table-cell" style:parent-style-name="Status"><style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#cc0000"/></style:style><style:style style:name="Error" style:family="table-cell" style:parent-style-name="Status"><style:table-cell-properties fo:background-color="#cc0000" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#ffffff" fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="Accent" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/></style:style><style:style style:name="Accent_20_1" style:display-name="Accent 1" style:family="table-cell" style:parent-style-name="Accent"><style:table-cell-properties fo:background-color="#000000" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#ffffff"/></style:style><style:style style:name="Accent_20_2" style:display-name="Accent 2" style:family="table-cell" style:parent-style-name="Accent"><style:table-cell-properties fo:background-color="#808080" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/><style:text-properties fo:color="#ffffff"/></style:style><style:style style:name="Accent_20_3" style:display-name="Accent 3" style:family="table-cell" style:parent-style-name="Accent"><style:table-cell-properties fo:background-color="#dddddd" fo:wrap-option="no-wrap" style:shrink-to-fit="false"/></style:style><style:style style:name="Result" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N121"><style:table-cell-properties fo:background-color="#e6e6e6" fo:border="0.06pt solid #000000"/><style:text-properties fo:font-style="normal" style:text-underline-style="none" fo:font-weight="normal"/></style:style><style:style style:name="Comments" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N100"><style:table-cell-properties style:diagonal-bl-tr="none" style:diagonal-tl-br="none" fo:wrap-option="wrap"/><style:text-properties fo:color="#999999" fo:font-style="italic"/></style:style><style:style style:name="Result2" style:family="table-cell" style:parent-style-name="Result" style:data-style-name="N120"><style:table-cell-properties fo:background-color="#ffcf63"/><style:text-properties fo:color="#6b4000" fo:font-weight="bold"/></style:style><style:style style:name="Background" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:background-color="#303063"/><style:text-properties fo:color="#c0c0c0"/></style:style><style:style style:name="Card" style:family="table-cell" style:parent-style-name="Default"><style:table-cell-properties fo:background-color="#ffffcc" style:text-align-source="fix" style:repeat-content="false" fo:padding-bottom="0.035cm" fo:padding-left="0.035cm" fo:padding-right="0.335cm" fo:padding-top="0.035cm"/><style:paragraph-properties fo:text-align="end"/><style:text-properties fo:font-weight="normal"/></style:style><style:style style:name="Input" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="N121"><style:table-cell-properties style:cell-protect="none" style:print-content="true" style:text-align-source="value-type" style:repeat-content="false" fo:background-color="transparent" fo:border="0.06pt solid #000000" style:shadow="none"/></style:style><style:style style:name="Card_20_TL" style:display-name="Card TL" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties fo:border-bottom="none" fo:border-left="0.06pt solid #000080" fo:border-right="none" fo:border-top="0.06pt solid #000080"/></style:style><style:style style:name="Card_20_T" style:display-name="Card T" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties fo:border-bottom="none" fo:border-left="none" fo:border-right="none" fo:border-top="0.06pt solid #000080"/></style:style><style:style style:name="Card_20_TR" style:display-name="Card TR" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties fo:border-bottom="none" fo:border-left="none" fo:border-right="0.06pt solid #000080" fo:border-top="0.06pt solid #000080"/></style:style><style:style style:name="Card_20_L" style:display-name="Card L" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties fo:border-bottom="none" fo:border-left="0.06pt solid #000080" fo:border-right="none" fo:border-top="none"/></style:style><style:style style:name="Card_20_R" style:display-name="Card R" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties fo:border-bottom="none" fo:border-left="none" fo:border-right="0.06pt solid #000080" fo:border-top="none"/></style:style><style:style style:name="Card_20_B" style:display-name="Card B" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties fo:border-bottom="0.06pt solid #000080" fo:border-left="none" fo:border-right="none" fo:border-top="none"/></style:style><style:style style:name="Card_20_BL" style:display-name="Card BL" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties fo:border-bottom="0.06pt solid #000080" fo:border-left="0.06pt solid #000080" fo:border-right="none" fo:border-top="none"/></style:style><style:style style:name="Card_20_BR" style:display-name="Card BR" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties fo:border-bottom="0.06pt solid #000080" fo:border-left="none" fo:border-right="0.06pt solid #000080" fo:border-top="none"/></style:style><style:style style:name="Column_20_Header" style:display-name="Column Header" style:family="table-cell" style:parent-style-name="Card"><style:table-cell-properties style:text-align-source="fix" style:repeat-content="false" fo:wrap-option="wrap" fo:padding="0.035cm" style:vertical-align="automatic"/><style:paragraph-properties fo:text-align="center"/></style:style><draw:marker draw:name="Arrowheads_20_1" draw:display-name="Arrowheads 1" svg:viewBox="0 0 20 30" svg:d="M10 0l-10 30h20z"/><loext:theme loext:name="Office"><loext:theme-colors loext:name="LibreOffice"><loext:color loext:name="dark1" loext:color="#000000"/><loext:color loext:name="light1" loext:color="#ffffff"/><loext:color loext:name="dark2" loext:color="#000000"/><loext:color loext:name="light2" loext:color="#ffffff"/><loext:color loext:name="accent1" loext:color="#18a303"/><loext:color loext:name="accent2" loext:color="#0369a3"/><loext:color loext:name="accent3" loext:color="#a33e03"/><loext:color loext:name="accent4" loext:color="#8e03a3"/><loext:color loext:name="accent5" loext:color="#c99c00"/><loext:color loext:name="accent6" loext:color="#c9211e"/><loext:color loext:name="hyperlink" loext:color="#0000ee"/><loext:color loext:name="followed-hyperlink" loext:color="#551a8b"/></loext:theme-colors></loext:theme></office:styles><office:automatic-styles><number:number-style style:name="N2"><number:number number:decimal-places="2" number:min-decimal-places="2" number:min-integer-digits="1"/></number:number-style><style:page-layout style:name="Mpm1"><style:header-style><style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm"/></style:header-style><style:footer-style><style:header-footer-properties fo:min-height="0.751cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm"/></style:footer-style></style:page-layout><style:page-layout style:name="Mpm2"><style:page-layout-properties style:num-format="1" style:print-orientation="landscape" style:table-centering="horizontal"/><style:header-style><style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0.25cm" fo:border="2.49pt solid #000000" fo:padding="0.018cm" fo:background-color="#c0c0c0"><style:background-image/></style:header-footer-properties></style:header-style><style:footer-style><style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0.25cm" fo:border="2.49pt solid #000000" fo:padding="0cm" fo:background-color="transparent"><style:background-image/></style:header-footer-properties></style:footer-style></style:page-layout><style:page-layout style:name="Mpm3"><style:page-layout-properties fo:margin-top="1.905cm" fo:margin-bottom="1.905cm" fo:margin-left="1.778cm" fo:margin-right="1.778cm" style:first-page-number="continue" style:writing-mode="lr-tb"/><style:header-style><style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0.122cm" fo:margin-right="0.122cm" fo:margin-bottom="0cm"/></style:header-style><style:footer-style><style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0.122cm" fo:margin-right="0.122cm" fo:margin-top="0cm"/></style:footer-style></style:page-layout><style:page-layout style:name="Mpm4"><style:page-layout-properties fo:margin-top="2.499cm" fo:margin-bottom="2.499cm" fo:margin-left="1.9cm" fo:margin-right="1.9cm" style:first-page-number="continue" style:writing-mode="lr-tb"/><style:header-style><style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-bottom="0cm"/></style:header-style><style:footer-style><style:header-footer-properties fo:min-height="0.75cm" fo:margin-left="0cm" fo:margin-right="0cm" fo:margin-top="0cm"/></style:footer-style></style:page-layout><style:style style:name="MT1" style:family="text"><style:text-properties fo:color="#000000" loext:opacity="100%" style:text-outline="false" style:text-line-through-style="none" style:text-line-through-type="none" style:font-name="Liberation Sans" fo:font-size="10pt" fo:language="zxx" fo:country="none" fo:font-style="normal" fo:text-shadow="none" style:text-underline-style="none" fo:font-weight="normal" style:text-underline-mode="continuous" style:text-overline-mode="continuous" style:text-line-through-mode="continuous" style:font-name-asian="HG Mincho Light J" style:font-size-asian="10pt" style:language-asian="zxx" style:country-asian="none" style:font-style-asian="normal" style:font-weight-asian="normal" style:font-name-complex="Liberation Sans Unicode MS" style:font-size-complex="10pt" style:language-complex="zxx" style:country-complex="none" style:font-style-complex="normal" style:font-weight-complex="normal" style:text-emphasize="none" style:font-relief="none"/></style:style></office:automatic-styles><office:master-styles><style:master-page style:name="Default" style:page-layout-name="Mpm1"><style:header><text:p><text:sheet-name>???</text:sheet-name></text:p></style:header><style:header-left style:display="false"/><style:header-first style:display="false"/><style:footer><text:p><text:span text:style-name="MT1">Page </text:span><text:page-number>1</text:page-number></text:p></style:footer><style:footer-left style:display="false"/><style:footer-first style:display="false"/></style:master-page><style:master-page style:name="Report" style:page-layout-name="Mpm2"><style:header style:display="false"><style:region-left><text:p><text:span text:style-name="MT1"><text:sheet-name>???</text:sheet-name></text:span><text:span text:style-name="MT1"><text:s/>(</text:span><text:span text:style-name="MT1"><text:title>???</text:title></text:span><text:span text:style-name="MT1">)</text:span></text:p></style:region-left><style:region-right><text:p><text:span text:style-name="MT1"><text:date style:data-style-name="N2" text:date-value="2026-10-09">00/00/0000</text:date></text:span><text:span text:style-name="MT1">, </text:span><text:span text:style-name="MT1"><text:time style:data-style-name="N2" text:time-value="09:30:45.711275300">00:00:00</text:time></text:span></text:p></style:region-right></style:header><style:header-left style:display="false"/><style:header-first style:display="false"/><style:footer><text:p><text:span text:style-name="MT1">Page </text:span><text:page-number>1</text:page-number></text:p></style:footer><style:footer-left style:display="false"/><style:footer-first style:display="false"/></style:master-page><style:master-page style:name="PageStyle_5f_Settings" style:display-name="PageStyle_Settings" style:page-layout-name="Mpm3"><style:header style:display="false"/><style:header-left style:display="false"/><style:header-first style:display="false"/><style:footer style:display="false"/><style:footer-left style:display="false"/><style:footer-first style:display="false"/></style:master-page><style:master-page style:name="PageStyle_5f_fctnum" style:display-name="PageStyle_fctnum" style:page-layout-name="Mpm4"><style:header style:display="false"/><style:header-left style:display="false"/><style:header-first style:display="false"/><style:footer style:display="false"/><style:footer-left style:display="false"/><style:footer-first style:display="false"/></style:master-page><style:master-page style:name="PageStyle_5f_fctnum_20_1" style:display-name="PageStyle_fctnum 1" style:page-layout-name="Mpm4"><style:header style:display="false"/><style:header-left style:display="false"/><style:header-first style:display="false"/><style:footer style:display="false"/><style:footer-left style:display="false"/><style:footer-first style:display="false"/></style:master-page><style:master-page style:name="PageStyle_5f_fctnum_20_2" style:display-name="PageStyle_fctnum 2" style:page-layout-name="Mpm4"><style:header style:display="false"/><style:header-left style:display="false"/><style:header-first style:display="false"/><style:footer style:display="false"/><style:footer-left style:display="false"/><style:footer-first style:display="false"/></style:master-page></office:master-styles></office:document-styles>+ \ No newline at end of file
: bharatvaj/lobasic-macros