update 20251210
This commit is contained in:
@@ -18,7 +18,11 @@ using System.IO;
|
||||
using System.Drawing.Printing;
|
||||
using Syncfusion.Windows.Forms.PdfViewer;
|
||||
using Syncfusion.Windows.PdfViewer;
|
||||
using Newtonsoft;
|
||||
using Newtonsoft;
|
||||
using Newtonsoft.Json;
|
||||
using System.Diagnostics;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
|
||||
namespace ZZPDFTest
|
||||
{
|
||||
@@ -270,5 +274,70 @@ namespace ZZPDFTest
|
||||
{
|
||||
pdfViewerControl1.Load(@"E:\Software-Projekte\OnDoc\Office_Vorlagen\20251110_PRIIP Arete Ethik Vorsorgefonds Global Balanced.pdf");
|
||||
}
|
||||
|
||||
private void button7_Click(object sender, EventArgs e)
|
||||
|
||||
{
|
||||
string jsonstring = System.IO.File.ReadAllText(@"E:\Software-Projekte\OnDoc\Office_Vorlagen\essdemo.json");
|
||||
|
||||
dynamic dataj = JsonConvert.DeserializeObject(jsonstring);
|
||||
Console.WriteLine(dataj.Bp.Zustaendiger.TgNummer);
|
||||
|
||||
|
||||
|
||||
|
||||
//foreach (var bpis in JsonConvert.DeserializeObject<dynamic>(jsonstring))
|
||||
//{
|
||||
// Console.WriteLine(bpis.Name);
|
||||
// Console.WriteLine(bpis.Value);
|
||||
|
||||
//}
|
||||
|
||||
List<docitem> docitemlist = new List<docitem>();
|
||||
var jo = JObject.Parse(jsonstring);
|
||||
var valueTuples = GetNodes(jo).ToList();
|
||||
foreach ( var valueTuple in valueTuples)
|
||||
{
|
||||
docitem d = new docitem();
|
||||
d.itemname= valueTuple.Item1;
|
||||
d.itemtag= valueTuple.Item2;
|
||||
d.itemvalue= valueTuple.Item3;
|
||||
d.doclinkname = "";
|
||||
docitemlist.Add(d);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class docitem
|
||||
{
|
||||
public string itemname;
|
||||
public string itemtag;
|
||||
public string itemvalue;
|
||||
public string doclinkname;
|
||||
}
|
||||
private IEnumerable<(string path, string key, string value)> GetNodes(JToken token)
|
||||
{
|
||||
foreach (var jt in token.Children())
|
||||
{
|
||||
if (!jt.Children().Any())
|
||||
{
|
||||
yield return (
|
||||
path: jt.Path,
|
||||
key: jt.Path.Split('.').Last(),
|
||||
value: jt.ToString()
|
||||
);
|
||||
}
|
||||
|
||||
foreach (var (path, key, value) in GetNodes(jt))
|
||||
{
|
||||
yield return (path, key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user