We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Wrong place for title and created date time attribute (Java version)

The Library converts .one file’s metadata incorrectly.
Version: 22.9

Feel free to make your own experiments: MySectionName.one.zip (4.7 KB)

Original OneNote Page
Please, have look at the red rectangle place
SCR-20221103-e84.png (28.5 KB)

Converted OneNote Page (HMTL)

  1. Title is located in the incorrect place - must be in title tag
  2. Date is located in the incorrect place - must be in meta tag
  3. Time is located in the incorrect place - must be in meta tag
<html>
	<head>
		<meta charset="utf-8" />
		<title>
		</title>
		<link rel="stylesheet" type="text/css" />
	</head>
	<body>
		<div class="stl_ stl_02">
			<div class="stl_view">
				<div class="stl_03 stl_04">
					<div class="stl_01" style="left:7.20pt;top:18.00pt;"><span class="stl_05 stl_06 stl_07">Page One</span></div>
					<div class="stl_01" style="left:7.20pt;top:40.64pt;"><span class="stl_08 stl_09 stl_07">Wednesday, November 2, 2022</span></div>
					<div class="stl_01" style="left:167.60pt;top:40.64pt;"><span class="stl_08 stl_09 stl_07">1:48 PM</span></div>
					<div class="stl_01" style="left:7.20pt;top:90.00pt;"><span class="stl_10 stl_11 stl_07">Some content</span></div>
				</div>
			</div>
		</div>
	</body>
</html>

@aaukhatov,

Thanks for the sample document and screenshot.

How do you create your ONENOTE file via Aspose.Note for Java, could you please share sample code to generate the file? We will check your issue soon.

The file was created by OneNote I don’t have code for that, I use Aspose.Note just to parse such files.

@aaukhatov,

I did test the scenario/case by loading your sample document and re-saved it. I do not find any issue with input and output document regarding title and date display when viewing into ONENOTE:
e.g.
Sample code:

com.aspose.note.Document doc1 = new com.aspose.note.Document("E:\\test2\\MySectionName.one");
doc1.save("e:\\test2\\out1.one", SaveFormat.One);

Which version of the API you are using? How could we reproduce the issue on our end, please elaborate?

@Amjad_Sahi
Actually, I didn’t get why you save the .one file as SaveFormat.One it looks funny.
Anyway, it’s wrong reproducing.
You have to save as HTML to reproduce this bug.

        HtmlSaveOptions options = new HtmlSaveOptions();
		options.setExportCss(ResourceExportType.NoExport);
		options.setExportFonts(ResourceExportType.NoExport);
		options.setExportImages(ResourceExportType.ExportAsStream);
		options.setPageCount(1); // put the proper page number

@aaukhatov,

Thanks for further details and code segment.

I tested your scenario/case using your sample document. Now I understand your mentioned issue. I noticed what you highlighted in the first post. But when I did render/export to .mht/html in ONENOTE application manually, I see the similar thing. I mean all contents are rendered in the body tag and not in your highlighted sections. So, Aspose.Note works/renders documents in the same way as what ONENOTE does.

You may skip specifying/setting SaveFormat when rendering the ONENOTE document. This is optional.

@Amjad_Sahi,
Are you going to fix this bug?

@aaukhatov,

Generally, we follow ONENOTE application for rendering HTML/MHTML files, so we won’t fix it.

@Amjad_Sahi,
This is official documentation, please have a look at https://learn.microsoft.com/en-us/graph/onenote-create-page

image.png (77.8 KB)

@aaukhatov,

Thanks for sharing further details and screenshot.

Since we already tested your scenario/case and noticed the issue you mentioned. Aspose.Note renders Title and Created Date/Time attributes in the body section when rendering ONENOTE document to HTML. To investigate your requirements, we have logged a ticket with an id “NOTEJAVA-1139” into our database. We will check if we could enhance the HTML rendering a bit.

Once we have an update on it, we will let you know here.

1 Like

@aaukhatov,

We investigated your issue in details.
Aspose.Note renders documents in the same way as OneNote desktop app does, i.e. all contents under the body tag. Yes, it is different from HTML with OneNote Online service. But we don’t see any huge visual discrepancies or differences between original document and its HTML version generated by Aspose.Note.

Could you please tell and provide details why it is important for you to have slightly different HTML with the same visual rendering?

@Amjad_Sahi
I get your point, please try to understand my point as well.
When we rendered OneNote to HTML we do something about our business (for now it doesn’t matter, something related to a content of a note). Then we create a new one via MS OneNote API, this API requires us to put created date time, and title into <meta> tag.

@aaukhatov,

Thanks for sharing the detail. I have recorded it with your ticket into our database. We will evaluate it and get back to you.