newtonsoft,json.jsonconvert

hallo there,


i would need some help


if do this in C

Stream stream = File.OpenRead(path);

WordDocument document = WordDocument.Load(stream, Syncfusion.EJ2.DocumentEditor.FormatType.Docx);

string json = Newtonsoft.Json.JsonConvert.SerializeObject(document);

it works fine out is the worddocument and can be loaded into the docment

editor

output =

{"sections":[{"blocks":[{"paragraphFormat":{"styleName":"Title"},"inlines":[{"text":"Styles"}]},{"paragraphFormat":{"styleName":"Subtitle"},"inlines":[{"text":"A"},{"text":" style is a collection of formatting instructions"},{"text":" "},{"text":"to provide a consistent look of the document"},{"text":"."}]},{"inlines":[]},{"paragraphFormat":{"styleName":"Quote"},"inlines":[{"text":"The quick brown fox jumps over the lazy dog"},{"text":" [Quote]"}]},{"inlines":[{"name":"_GoBack","bookmarkType":0},{"name":"_GoBack","bookmarkType":1}]},{"paragraphFormat":{"styleName":"Heading 1"},"inlines":[{"text":"The quick brown fox jumps over the lazy dog "},{"text":"["},{"text":"Heading 1"},{"text":"]"}]},{"inlines":[]},{"paragraphFormat":{"styleName":"Heading 2"},"inlines":[{"text":"The quick brown fox jumps over the lazy dog "},{"text":"["},{"text":"Heading 2"},{"text":"]"}]},{"inlines":[]},{"paragraphFormat":{"styleName":"Heading 3"},"inlines":[{"text":"The quick brown fox jumps over the lazy dog"},{"text":" "},{"text":"["},{"text":"Heading 3"},{"text":"]"}]},{"inlines":[]},{"paragraphFormat":{"styleName":"Heading 4"},"inlines":[{"text":"The quick brown fox jumps over the lazy dog "},{"text":"[Heading 4"},{"text":"]"}]},{"inlines":[]},{"paragraphFormat":{"styleName":"Heading 5"},"inlines":[{"text":"The quick brown fox jumps over the lazy dog "},{"text":"["},{"text":"Heading 5"},{"text":"]"}]},{"inlines":[]}],"headersFooters":{},"sectionFormat":{"headerDistance":36.0,"footerDistance":36.0,"pageWidth":612.0,"pageHeight":792.0,"leftMargin":72.0,"rightMargin":72.0,"topMargin":72.0,"bottomMargin":72.0,"differentFirstPage":false,"differentOddAndEvenPages":false,"bidi":false,"restartPageNumbering":false,"pageStartingNumber":0,"endnoteNumberFormat":"LowerCaseRoman","footNoteNumberFormat":"Arabic","restartIndexForFootnotes":"DoNotRestart","restartIndexForEndnotes":"DoNotRestart","columns":{"column":[{"width":468.0,"space":36.0}],"numberOfColumns":1,"equalWidth":true}}}],"fontSubstitutionTable":{"Yu Mincho":"游明朝","Yu Gothic Light":"游ゴシック Light"},"characterFormat":{"fontSize":11.0,"fontFamily":"Calibri","fontSizeBidi":11.0,"fontFamilyBidi":"Arial"},"paragraphFormat":{"afterSpacing":8.0,"lineSpacing":1.0791666507720947,"lineSpacingType":"Multiple"},"background":{"color":"#FFFFFFFF"},"styles":[{"type":"Paragraph","name":"Normal","next":"Normal"},{"type":"Paragraph","name":"Heading 1","basedOn":"Normal","next":"Normal","link":"Heading 1 Char","characterFormat":{"fontSize":16.0,"fontFamily":"Calibri Light","fontColor":"#2F5496FF","fontSizeBidi":16.0,"fontFamilyBidi":"Times New Roman"},"paragraphFormat":{"beforeSpacing":12.0,"afterSpacing":0.0,"outlineLevel":"Level1","keepWithNext":true,"keepLinesTogether":true}},{"type":"Paragraph","name":"Heading 2","basedOn":"Normal","next":"Normal","link":"Heading 2 Char","characterFormat":{"fontSize":13.0,"fontFamily":"Calibri Light","fontColor":"#2F5496FF","fontSizeBidi":13.0,"fontFamilyBidi":"Times New Roman"},"paragraphFormat":

etc,etc

---------------------------------------------------------------------------------------------------------------------


but if i am doing the same thing in vb

Dim stream As Stream = File.OpenRead(path)

Dim wdoc As WordDocument = WordDocument.Load(stream, Syncfusion.EJ2.DocumentEditor.FormatType.Docx)

Dim json As String = Newtonsoft.Json.JsonConvert.SerializeObject(wdoc)

the ouput is not anywhere near a usable json string

here the output is 

{"fontSubstitutionTable":{"Yu Mincho":"游明朝","Yu Gothic Light":"游ゴシック Light"},"background":{"color":"#FFFFFFFF"},"defaultTabWidth":36.0,"formatting":false,"trackChanges":false,"protectionType":"NoProtection","enforcement":false,"dontUseHTMLParagraphAutoSpacing":false,"alignTablesRowByRow":false,"formFieldShading":true,"footnotes":{},"endnotes":{},"compatibilityMode":"Word2013"}

-------------------------------------------------------------------------------------------------------------------

the same word doc is used only in a different path

thanks for your help




3 Replies

SM Suriya Murugan Syncfusion Team January 31, 2022 06:45 AM UTC

Hi Rene,


Please check below KB link with sample and it may helpful for you.


https://www.syncfusion.com/kb/10295/how-to-open-and-save-file-from-server-using-ajax-call-in-asp-net-mvc


Please let us know if you still facing issue. If yes, please share the simple sample. That will be helpful for us to proceed further and provide you the solution at the earliest.


Regards,

Suriya M.



RE René January 31, 2022 07:36 PM UTC

Thanks for that,


i found the issue, it had to do with Versions of syncfusion EJ2.Documenteditor, some how i loaded the Version from 19.4.0.38 via Nuget. Which did not work.

I deleted it from the project, than i used the Version which had been installed with the ASP.Net MVC control Panel on my computer, and it worked, reason whats the difference i cannot say but it did the job.

So this onn is solved


best regards



SM Suriya Murugan Syncfusion Team February 1, 2022 06:52 AM UTC

Thanks for your update.

Loader.
Up arrow icon