Пример экспорт таблицы в Excel(.xls) используя ADOX - https://learn.microsoft.com/en-us/sql/ado/guide/extensions/provider-support-for-adox-ado?redirectedfrom=MSDN&view=sql-server-ver16Строка подключения - https://www.connectionstrings.com/microsoft-jet-ole-db-4-0/Add(MainForm,7134060,322,259) { Width=592 Height=483 link(onCreate,3024879:doDelete,[]) } Add(DS_OLEDB,12808009,511,259) { Name="xls_db" Point(onError) link(onCreate,16109952:doExec,[]) } Add(FormatStr,11826662,455,259) { DataCount=1 Mask="Provider=Microsoft.Jet.OLEDB.4.0; Data Source="%1"; Extended Properties=Excel 8.0" Point(FString) link(onFString,12808009:doOpen,[]) link(Str1,15120613:Var2,[]) } Add(VisualStrings,3042360,455,182) { Lines=#9:book1.xls| Width=67 } Add(StrList,11016052,609,168) { Strings=#56:23544122;Carbon disc ?44,7/38,3x5,8mm;10;PC;16,92;169,20|56:23544122;Carbon disc ?44,7/38,3x5,8mm;10;PC;16,92;169,20|54:23544122;Carbon disc ?44,7/38,3x5,8mm;2;PC;16,92;33,84|64:21200159;Top part UNIFL3/4 for steel bot.part;25;PC;30,09;752,25|57:24400111;Hose f. pump compl. UNIWASH;153;PC;10,58;1618,74|58:13225;Piston complete for valve UNIWASH3;4;PC;27,09;108,36|60:12200105;Vacuumgauge glycerine ?100mm 3/8";5;PC;40,57;202,85|54:21200141;Thread bush UNIFLOW3 steel;130;PC;1,93;250,90|45:25100146;O-ring ?16,1x1,6mm;175;PC;0,36;63,00|57:21200127;Holder rocking lever, UNIFLOW3;170;PC;0,26;44,20|50:21200131;Rocking lever UNIFLOW3;150;PC;0,89;133,50|65:25200132;Valve button inside UNIFLOW3 steel FA;225;PC;0,72;162,00|61:21200129;Bar closing device UNIFLOW3 steel;225;PC;1,09;245,25|55:25200124;Valve flap outside UNIFLOW3;225;PC;1,56;351,00|60:14400212;Solenoid valve sgl. invensys 230vac;5;PC;8,50;42,50|62:14400213;Solenoid valve dobb. invensys 230vac;5;PC;14,13;70,65|48:21200131;Rocking lever UNIFLOW3;20;PC;0,89;17,80|63:25200132;Valve button inside UNIFLOW3 steel FA;20;PC;0,72;14,40|43:25100146;O-ring ?16,1x1,6mm;20;PC;0,36;7,20|55:21200127;Holder rocking lever, UNIFLOW3;20;PC;0,26;5,20|58:21200130;Bar closing device UNIFLOW3 steel;20;PC;0,34;6,80|58:25200119;Guard bracket UNIFLOW3 steel SBS;20;PC;3,38;67,60|55:13474;Valve flap exterior UNIFLOW3 SBS;20;PC;1,56;31,20|59:26400104;Terminal wheel for lock guide str;20;PC;1,12;22,40|67:25215022;Rubber liner UNIFL. 15022-?22 UNIFLEX FA;96;PC;2,39;229,44|55:14800695;Hose guide f. SAC115 complete;10;PC;9,17;91,70|36:14306;Filter for IDC;20;PC;0,40;8,00|51:25515435;Rubber hose ?27/16 mm - FA;15;M;5,24;78,60|63:13930;Double-action Quickstart II rem. L=740mm;1;PC;98,66;98,66|54:13100201;Spray gun for udder washer;20;PC;17,77;355,40|0:| } Add(ArrayEnum,1512985,623,259) { link(onItem,3351570:doEvent1,[]) link(onEndEnum,5339090:doEvent1,[(669,272)(669,307)]) link(Array,11016052:Array,[]) } Add(MT_String,7011876,805,252) { link(onResult,15378171:doString,[]) } Add(DSC_Exec,16109952,567,259) { SQL="CREATE TABLE [TestTable] (\r\n[Артикул] VarChar(255), \r\n[Название] VarChar(255), \r\n[Кол-во] Double, \r\n[Ед.изм.] VarChar(255), \r\n[Цена] Double, \r\n[Сумма] Double\r\n)" DSManager="xls_db" link(onExec,1512985:doEnum,[]) } Add(FormatStr,15378171,854,252) { DataCount=6 Mask="INSERT INTO TestTable VALUES ('%1','%2','%3','%4','%5','%6');" link(onFString,9651247:doExec,[]) } Add(DSC_Exec,9651247,924,252) { DSManager="xls_db" } Add(FileTools,3024879,392,259) { FileName="book1.xls" link(onEnd,11826662:doString,[]) link(FileName,15120613:Var1,[(398,222)]) } Add(GetDataEx,15120613,455,217) { link(Data,3042360:Text,[]) } Add(WinExec,5759325,728,301) { link(FileName,15120613:Var3,[(734,222)]) } Add(Hub,5339090,679,301) { link(onEvent1,12808009:doClose,[(705,307)(705,330)(501,330)(501,272)]) link(onEvent2,5759325:doShellExec,[]) } Add(StringTable,7718047,805,203) { Width=576 Height=444 Align=5 Columns=#7:Артикул|9:Название |7:Кол-во |7:Ед.изм.|5:Цена |5:Сумма|0:| Point(Strings) } Add(Hub,3351570,763,259) { link(onEvent1,7718047:doAdd,[(788,265)(788,209)]) link(onEvent2,7011876:doMTString,[]) }
То же самое, но на VBJScript Add(MainForm,2953706,70,105) { Width=624 Height=446 link(onCreate,3024879:doDelete,[]) } Add(StrList,11016052,189,49) { Strings=#56:23544122;Carbon disc ?44,7/38,3x5,8mm;10;PC;16,92;169,20|56:23544122;Carbon disc ?44,7/38,3x5,8mm;10;PC;16,92;169,20|54:23544122;Carbon disc ?44,7/38,3x5,8mm;2;PC;16,92;33,84|64:21200159;Top part UNIFL3/4 for steel bot.part;25;PC;30,09;752,25|57:24400111;Hose f. pump compl. UNIWASH;153;PC;10,58;1618,74|58:13225;Piston complete for valve UNIWASH3;4;PC;27,09;108,36|60:12200105;Vacuumgauge glycerine ?100mm 3/8";5;PC;40,57;202,85|54:21200141;Thread bush UNIFLOW3 steel;130;PC;1,93;250,90|45:25100146;O-ring ?16,1x1,6mm;175;PC;0,36;63,00|57:21200127;Holder rocking lever, UNIFLOW3;170;PC;0,26;44,20|50:21200131;Rocking lever UNIFLOW3;150;PC;0,89;133,50|65:25200132;Valve button inside UNIFLOW3 steel FA;225;PC;0,72;162,00|61:21200129;Bar closing device UNIFLOW3 steel;225;PC;1,09;245,25|55:25200124;Valve flap outside UNIFLOW3;225;PC;1,56;351,00|60:14400212;Solenoid valve sgl. invensys 230vac;5;PC;8,50;42,50|62:14400213;Solenoid valve dobb. invensys 230vac;5;PC;14,13;70,65|48:21200131;Rocking lever UNIFLOW3;20;PC;0,89;17,80|63:25200132;Valve button inside UNIFLOW3 steel FA;20;PC;0,72;14,40|43:25100146;O-ring ?16,1x1,6mm;20;PC;0,36;7,20|55:21200127;Holder rocking lever, UNIFLOW3;20;PC;0,26;5,20|58:21200130;Bar closing device UNIFLOW3 steel;20;PC;0,34;6,80|58:25200119;Guard bracket UNIFLOW3 steel SBS;20;PC;3,38;67,60|55:13474;Valve flap exterior UNIFLOW3 SBS;20;PC;1,56;31,20|59:26400104;Terminal wheel for lock guide str;20;PC;1,12;22,40|67:25215022;Rubber liner UNIFL. 15022-?22 UNIFLEX FA;96;PC;2,39;229,44|55:14800695;Hose guide f. SAC115 complete;10;PC;9,17;91,70|36:14306;Filter for IDC;20;PC;0,40;8,00|51:25515435;Rubber hose ?27/16 mm - FA;15;M;5,24;78,60|63:13930;Double-action Quickstart II rem. L=740mm;1;PC;98,66;98,66|54:13100201;Spray gun for udder washer;20;PC;17,77;355,40| } Add(StringTable,7718047,259,105) { Width=608 Height=407 Align=5 Columns=#7:Артикул|9:Название |7:Кол-во |7:Ед.изм.|5:Цена |5:Сумма|0:| Point(Strings) } Add(VBJScript,3595730,189,105) { WorkPoints=#6:doWork| EventPoints=#6:onRead|7:onStart| DataPoints=#3:csv|5:count| Script=#22:Sub doWork(Data,Index)|102:Const adDouble = 5, adDate = 7, adCurrency = 6, adBoolean = 11, adVarWChar = 202, adLongVarWChar = 203|53:Dim cat, tbl, col, oRs, oCon, arrLines, strLine, vals|0:|38:Set cat = Createobject("ADOX.Catalog")|111:cat.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=cbook3.xls;Extended Properties=Excel 8.0"|36:Set tbl = Createobject("ADOX.Table")|22:tbl.Name = "TestTable"|0:|37:Set col = Createobject("ADOX.Column")|8:With col|21: .Name = "Артикул"|22: .Type = adVarWChar|8:End With|22:tbl.Columns.Append col|17:Set col = Nothing|0:|37:Set col = Createobject("ADOX.Column")|8:With col|22: .Name = "Название"|22: .Type = adVarWChar|8:End With|22:tbl.Columns.Append col|17:Set col = Nothing|0:|37:Set col = Createobject("ADOX.Column")|8:With col|20: .Name = "Кол-во"|20: .Type = adDouble|8:End With|22:tbl.Columns.Append col|17:Set col = Nothing|0:|37:Set col = Createobject("ADOX.Column")|8:With col|21: .Name = "Ед.изм."|22: .Type = adVarWChar|8:End With|22:tbl.Columns.Append col|17:Set col = Nothing|0:|37:Set col = Createobject("ADOX.Column")|8:With col|18: .Name = "Цена"|20: .Type = adDouble|8:End With|22:tbl.Columns.Append col|17:Set col = Nothing|0:|37:Set col = Createobject("ADOX.Column")|8:With col|19: .Name = "Сумма"|20: .Type = adDouble|8:End With|22:tbl.Columns.Append col|17:Set col = Nothing|0:|21:cat.Tables.Append tbl|0:|31:Set oCon = cat.ActiveConnection|0:|44:arrLines = Split(sys.csv, vbCrLf, sys.count)|0:|28:For Each strLine in arrLines|27: vals = Split(strLine, ";")|19: sys.onRead strLine|170: Set oRs = oCon.Execute("INSERT INTO TestTable VALUES ('"& vals(0) & "', '" & vals(1) & "', '" & vals(2) & "', '" & vals(3) & "', '" & vals(4) & "', '" & vals(5) & "' )")|4:Next|0:|17:Set oRs = Nothing|18:Set oCon = Nothing|17:Set tbl = Nothing|17:Set cat = Nothing|0:|15:sys.onStart nil|4: |7:End Sub| UseName=0 link(onRead,7718047:doAdd,[]) link(onStart,5759325:doShellExec,[(249,118)(249,167)]) link(csv,11016052:Text,[]) link(count,11016052:Count,[]) } Add(FileTools,3024879,133,105) { FileName="cbook3.xls" link(onEnd,3595730:doWork,[]) } Add(WinExec,5759325,259,154) { FileName="cbook3.xls" }
Редактировалось 3 раз(а), последний 2022-12-12 05:48:23
|