onenote-md-exporter
onenote-md-exporter copied to clipboard
Is Word neccesary ? Images missing in resource folder
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
Hi @devshank3 , could you export your OneNote notebook please (procedure here), I will try to reproduce.
Yes I'm able to export the whole notebook.
And I debugged the program with VS2019, The issues I found are
- The md text returned by
ConvertDocxToMd
in theConverterService
seemed to already have image reference in md format only and it was not a HTML tag. - 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 pagesvar pages = _oneNoteApp.FillSectionPages(section).Where(p => string.IsNullOrEmpty(pageNameFilter) || p.Title == pageNameFilter).ToList();
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
Hi @alxnbl,
Okay... I followed the steps and the result were....
- 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:
- 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:
And the Intermediate word(docx) files contained the images perfectly... I'm not sure were the issue is....
ScreenShot:
And as requested I have attached the export from my OneNote office desktop app, please debug it... Debug.zip
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 :
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.
I partly think there is some issue with my onenote. not sure .......
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:
It has HTML img tags whereas the below one doesn't, it is directly converted to md img references
Without MS Word installed:
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.
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.