Notes field is all garbage - looks like chinese

Not sure what is going on, but downloaded the latest version of the .DLL and now my NOTES field look like Chinese.

I am doing nothing different than what I did before this new dll, and the previous dll worked just fine.

In the previous .DLL the notes worked just fine, ie, it read the RTF, but as long as you did not have any special formats, it worked great. My notes are basically simple text.

Any suggestions

Hi,


I have created a new issue ‘Parse MPP Notes from RTF.’ with ID = 15789 and linked it to this forum thread.

You can find some previous discussion of the issue in this forum thread, as well as two samples of how the issue can be resolved on client side.

In old library’s version the second way with RichTextBox control was used but we had to remove it as it is not working in some environments (Windows’ riched20.dll is reqired). It looks that in your case you can use it.

I still can not provide you an exact issue implementation date. Sorry for inconvenience. Let us know if the issue is critical for you and we change its priority.

I just came here to post the same issue. I would expect the Notes field to return plain text and not garbage. For MPP it should return the raw RTF, but in the right code page, and for XML it should return the plain text.


I should not have to do this to get the RTF from the notes field (but I do):

byte[] bytes = Encoding.Unicode.GetBytes(notes);
string rtfAndNotChinese = Encoding.ASCII.GetString(bytes);

It seems like the Task API is reading in the MPP notes field in the wrong encoding.

The RichTextBox workaround for reading the plain text out of RTF is another matter. I think the Task class should have the Notes property always return the plain text notes (not rtf) and another property that returns the RTF for MPP (not in Chinese either), but null for XML.

It doesn’t seems like it would be too hard to parse the RTF format and get the plain text value, the actual text value starts with \fs16 , so something lighter weight than a Windows Forms control could be used.

This would be nice, but really the first issue is more important - the notes field for MPPs should return RTF and not garbage. Here’s an example of what it should return:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}}
{*\generator Riched20 12.0.6413.1000;}\viewkind4\uc1
\pard\f0\fs16 My Task Notes\par
}\0

Thanks for this code. ANd you are 100% correct. In fact, it used to work just fine before this latest update. I believe the entire point of RTF is that it is plain text, not encoded gibberish.

Your comments combined with using the RTF control clean things up, but what a pain.

thanks again for your quick decoding!

Dim bytes() As Byte = Encoding.Unicode.GetBytes(str)
Dim rtfandnotchinese As String = Encoding.ASCII.GetString(bytes)
Dim rtf As New RichTextBox

rtf.Rtf = rtfandnotchinese


Return rtf.Text

Hi,

Thank you a lot for detailed posts!!!

  1. We don’t use any encoding when read the Notes data, it is just the data as it is in MPP file.
  2. We are planning to add additional properties like NotesText and NotesRTF where the plain text can be stored, but I can not share the exact implementation date with you right now.

Unfortunately, different versions of MS Project interpret the Notes data by different way. I have used the code below and test data in attachment. MS Project 2003 can open the Result.xml file and reads Task1 notes by right way (see second screen shot) including formats while some versions of MS Project 2007 read it as garbage. You can check the data in the resulting files by yourselves.

I have used Aspose.Tasks 2.2.0 version from September 2009.

using System;
using System.IO;
using System.Collections.Generic;
using System.Text;
using Aspose.Tasks;
using System.Reflection;

namespace TestOldNotes
{
    class Program
    {
        static void Main(string[] args)
        {
            ProjectReader reader = new ProjectReader();
            ProjectWriter writer = new ProjectWriter();
            Project project;

            using (FileStream rfs = new FileStream("TestNotesProject.mpp", FileMode.Open, FileAccess.Read))
            {
                project = reader.Read(rfs);
            }

            using (FileStream wfs1 = new FileStream("Result.xml", FileMode.Create, FileAccess.Write))
            {
                writer.Write(project, wfs1, TasksDataFormat.XML);
            }

            Task task1 = (Task)project.RootTask.Children[0];
            string note = task1.Notes;
            string rtf = Encoding.ASCII.GetString(Encoding.Unicode.GetBytes(note));
            task1.Notes = rtf;
            using (FileStream wfs2 = new FileStream("ResultUpdated.xml", FileMode.Create, FileAccess.Write))
            {
                writer.Write(project, wfs2, TasksDataFormat.XML);
            }

            Console.WriteLine(typeof(Project).Assembly.FullName);
            Console.WriteLine("Note:");
            Console.WriteLine(note);
            Console.ReadLine();
        }
    }
}

The issues you have found earlier (filed as 16279) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Hi,


Now we have added NotesRTF and NotesText read-only public properties to Task and Resource classes, where NotesRTF contains the Notes RTF data and NotesText the plain text parsed from the RTF when the data was read from MPP file. The old Notes property was not changed for backward compatibility as some versions of MS Project can read the encoded RTF data from it.

Image and Unicode text parsing from the RTF is still under development. Sorry for inconvenience.

The issues you have found earlier (filed as ) have been fixed in this Aspose.Words for JasperReports 18.3 update.