Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用C#读取Excel中作为对象嵌入的JSON文件的内容?_C#_Json_Excel - Fatal编程技术网

如何使用C#读取Excel中作为对象嵌入的JSON文件的内容?

如何使用C#读取Excel中作为对象嵌入的JSON文件的内容?,c#,json,excel,C#,Json,Excel,我使用C#像这样将JSON文件嵌入Excel 现在,我想编写代码从excel访问此文件,并将其内容读入另一个字符串。这可能吗 string json = JsonConvert.SerializeObject(Properties); //The string contains data in JSON format File.WriteAllText(@"C:\PJson.json", json); Excel.Workbook book = xlApp.ActiveWorkbook; Exc

我使用C#像这样将JSON文件嵌入Excel

现在,我想编写代码从excel访问此文件,并将其内容读入另一个字符串。这可能吗

string json = JsonConvert.SerializeObject(Properties); //The string contains data in JSON format
File.WriteAllText(@"C:\PJson.json", json);
Excel.Workbook book = xlApp.ActiveWorkbook;
Excel.Worksheet sheet = book.Worksheets[11];
sheet.Shapes.AddOLEObject(Filename: @"C:\PJson.json", Height: 400, Width: 400);