Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile and run C# code string sent from QM to the LA HTTP server
#29
thank you so much!
I tested the code, it runs very fast and well.

Can you add code for the following two scenarios? This makes the application more versatile

Macro case1
Code:
Copy      Help
;If the first line of the code starts with /*/, automatically parse the referenced assembly
str code=
;/*/ nuget -\EPPlus; /*/
;using OfficeOpenXml;
;
;public class C {
;,public static void setCell(string f, string v) {
;,,ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
;,,
;,,string file = folders.Downloads + f;
;,,using (var package = new ExcelPackage(new FileInfo(file))) {
;,,,var sheet = package.Workbook.Worksheets[0];
;,,,var s = sheet.Cells["A1"].Value;
;,,,print.it(s);
;,,,sheet.Cells["A1"].Value = v;
;,,,package.Save();
;,,}
;,}
;}
out LaHttpCall("Code" F"code={code}" "fun=C.setCell" "f=Sample.xlsx" "v=new value")


Macro case2
Code:
Copy      Help
;When there are no classes and functions in the code, top-level statements can be executed directly.
str code=
;/*/ nuget -\EPPlus; /*/
;using OfficeOpenXml;
;
;ExcelPackage.LicenseContext = LicenseContext.NonCommercial;
;
;string file = folders.Downloads + "Sample.xlsx";
;using(var package = new ExcelPackage(new FileInfo(file))) {
;,var sheet = package.Workbook.Worksheets[0];
;,var s = sheet.Cells["A1"].Value;
;,print.it(s);
;,sheet.Cells["A1"].Value = "new value";
;,package.Save();
;}
out LaHttpCall("Code" F"code={code}" "fun=")


Messages In This Thread
RE: Compile and run C# code string sent from QM to the LA HTTP server - by Davider - 06-23-2023, 01:05 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)