onenote-md-exporter icon indicating copy to clipboard operation
onenote-md-exporter copied to clipboard

Is Word neccesary ? Images missing in resource folder

Open devshank3 opened this issue 2 years ago • 6 comments

Hi Developers, the console app is really great...

I ran the console app without MS Word installed.... It worked perfectly. Even the Intermediate .docx files where created with images in it.

But in the resource folder the images where missing & not even a single image was present. PDFs are present in resource folder.

I noticed in the markdowns it referred to this path "C:\Users*user*\AppData\Local\Temp*user*'s Notebook\pandoc\media" Inside the above path only the images of the last converted page of last section was available.

Some screen shots these were my last page in last section. only these were available image image

devshank3 avatar Mar 18 '22 08:03 devshank3

Hi @devshank3 , could you export your OneNote notebook please (procedure here), I will try to reproduce.

alxnbl avatar Mar 18 '22 12:03 alxnbl

Yes I'm able to export the whole notebook.

And I debugged the program with VS2019, The issues I found are

  1. The md text returned by ConvertDocxToMd in the ConverterService seemed to already have image reference in md format only and it was not a HTML tag.
  2. The ImageAttachements list seemed to not have any images attached to it for each page . I'm not sure why ........ from here, No imageattachments to any pages var pages = _oneNoteApp.FillSectionPages(section).Where(p => string.IsNullOrEmpty(pageNameFilter) || p.Title == pageNameFilter).ToList();

devshank3 avatar Mar 18 '22 13:03 devshank3

Hmm, thanks for the effort to debug. Strange....

Could you try to import the following notebook in ON and try to export it with the tool and see if section swith Image are correctly exported : https://github.com/alxnbl/onenote-md-exporter/blob/main/sample/TestBloc.onepkg .

If the problem do not appends with the TestBloc notebook, it means there is something specific with the Notebook you are trying to export. In that case, could you join an export of it to this ticket (after removing any personal data).

Thanks a lot

alxnbl avatar Mar 18 '22 19:03 alxnbl

Hi @alxnbl,

Okay... I followed the steps and the result were....

  1. I imported TestBloc and exported with your console tool the images within the tables(Table with Image, Réalisateurs etc) found their references correctly.... and the images were in the resource folder.

ScreenShots: image image

  1. But direct images in the long text, drawings etc did not find the reference to the resource folder & the images were not there in the resource folder. They referred to the temp pandoc folder in Appdata/local ScreenShots: image image

And the Intermediate word(docx) files contained the images perfectly... I'm not sure were the issue is.... ScreenShot: image

And as requested I have attached the export from my OneNote office desktop app, please debug it... Debug.zip

devshank3 avatar Mar 19 '22 04:03 devshank3

And one more observation

The tables I created in my notebook app in a page and the images in the tables are not being referenced correctly and they are not in the resources folder.

But the tables with images from the testbloc.one seems to work fine. The way it is converted in markdown also differs.

example : image

In this attached .one section note I have included the table I created & the table extracted from testbloc.one. both has images in them. please see their individual behavior. But the images which are directly attached are still not being referred in resources.

Debug2 - Copy.zip

I partly think there is some issue with my onenote. not sure .......

devshank3 avatar Mar 19 '22 06:03 devshank3

Okay I kinda figured out the issue, I tried the tool in my other laptop it worked fine.

Mainly I think this issue due to MS Word not installed in my PC.

But I'm surprised how _oneNoteApp.Publish(page.OneNoteId, Path.GetFullPath(docxFileTmpFile), PublishFormat.pfWord); is able to work fine and publish the word file, even if ms word is not installed.

And here I have attached the results of mdFileContent after mdFileContent = File.ReadAllText(mdFilePath); for both with MS Word & without MS Word installed in my PC.

With MS Word installed:

image It has HTML img tags whereas the below one doesn't, it is directly converted to md img references

Without MS Word installed:

image

I think this is root of the problem. Thanks a lot for creating such a great tool. Especially I think its great for Joplin users.

devshank3 avatar Mar 19 '22 08:03 devshank3

Thank you too for the analysis. I close the issue. Maybe with additional efforts the tool could work without Word but most of users have both OneNote and Word installed so I will not invest time on it.

alxnbl avatar Oct 25 '22 20:10 alxnbl