Now, I’m trying to use formatting citations function in my plugin, and I found a bug with IFormatServices.GetOutputStyles Api.
the bug is described as follows
I set the style folder in “endnote preferences” to folder “D:\Program Files\EndNote\Styles\Style”, this folder exists and with some own styles in it.
when using endnote, I can find these styles when chosing a output style.
when I using IFormatService GetOutputStyles function to get the whole list of my styles, these styles in “D:\Program Files\EndNote\Styles\Style” are not in the list.
so this seems to be a bug.
The version of endnote is X4 update 2(updated just now).
Besides, when using codes in Chapter 12. Formatting Citations
these code
IFormatServiceCallback* MyFormatImplementation::CreateInstance( /*params needed for your implementation*/ )
{
// Because your implementation is derived from RSService objects that are, in
// turn, based on reference counting semantics, it is important to properly
// initialize the underlying reference counting mechanisms. This should be
// done by allocating the object on the heap and using the CBaseObject
// template to instantiate your implementation. That template takes care of
// implementing reference counting, but it means you can only use a
// default constructor to initialize your class. As such, it is often easiest
// to use a "create" function that calls CBaseObject<> and inits all member
// variables requiring external parameters. So CreateInstance() here is just
// a convenience function to encapsulate CBaseObject<> and member initialization
// in one place. It's not a required way of doing it, just an easy way of doing
// it. You can do it in alternate ways, depending on the needs of your code.
IFormatServiceCallbackPtr p = new CBaseObject< MyFormatImplementation >();
if (p)
{
// init any members using passed-in parameters
}
// note that we didn't use a smart pointer above, since that would have
// freed our newly created object when the function went out of scope.
return p;
}
<format_reflist><style>AAG Style Guide.ens</style><starting-refnum>1</starting-refnum><progress-message>Sorry for the inconvenience!</progress-message></format_reflist>
Removing the progress-message tag form the XML, if you look at the IFormatServiceTest.cpp file in the rsservicestest plugin that came with the RDK you will see that tag was not present.
You may want to check that the MyFormatImplemntation::CreateInstance() call is returning successfully. It is possible that there is a problem with the callback.
So, from ubove results, we can found, even using the RSServicesTest project in the RDK, the function formatrecords also returns 23000 error. And after reading the codes, I found that we should have outputs like
I just ran RSServicesTest and, sure enough, FormatRecords appears to be failing on this end, too. However, I’m able to get it to work, by fixing the following item in the test code:
Once I remove the “.ens” from the style name, the test succeeds. The test code and yours is mostly modeled after the sample in Chapter 12, which also has the ‘.ens’ extension in the name. If you remove the ‘.ens’ within this line of code:
xml << CT2A(pList->item(1));
does that fix the problem?
As an aside, you can see that the RSServicesTest code for FormatManuscript doesn’t use the .ens for its <output-style> node, which is consistent with the documentation on pp. 281 & 282 for that node. On my side, the FormatManuscript node passes the test, so I suspect in that particular case you might just not have the Annotated style in your set of styles, as that’s the one that particular test relies upon.
Let me know if the .ens change resolves your problem. Hope this helps!
All formatServices related functions have this problem. The events of FormatSeviceCallback was not called.
Such as FormatManuscript, FormatRecord, FormatRecordIDs and FormatRecords.
Take the RSServicesTest project that came from the RDK samples for example.
Default, all format functions in RSServicesTest are failed.
And you can find a note “//TODO: verify this is working, I suspect it is not since the CBs are not called” in the IFormatServiceTest.cpp. This means that the guy who wrote this sample also find this problem.
After changing the “Numbered.ens” to “Numbered” as you said.
FormatRecords function seems to work correctly.
But other functions, FormatRecord, FormatRecordIDs and FormatManuscript remain don’t work.
All above results are taken from the RSServicesTest project. And I think you can also test them yourself.
I’m still waiting for the solutions to these problems.
“But other functions, FormatRecord, FormatRecordIDs and FormatManuscript remain don’t work.”
FormatRecord and FormatRecordIDs are actually deprecated v2.0 functions. EndNote doesn’t support them anymore, which also reflects the “TODO” comment you noticed: the author of the test script wasn’t aware of that when that test was first coded, but the comment was never removed.
Since it sounds like the ‘.ens’ change is working for FormatRecords, that leaves only the issue with FormatManuscript. FormatManuscript is actually used in live production code, and it works when I run RSServicesTests on all the machines I try here. So I suspect that it might just be a problem in the test parameters that aren’t consistent with your environment.
The simplest problem would be that the style being used in the FormatManuscript XML is not available in your environment. If you change the definition of ‘szManuscriptFormatSpec’ in IFormatServiceTest.cpp to a different style, e.g. ‘Numbered’, does it work? Note that I suggest ‘Numbered’ only because it sounds like that worked for your FormatRecords test, so I’m assuming that one is definitely available in your style folder.
OK, I got it, now I’m using FormatRecords api in my plugin, and it works well.
BTW : It seems that the documents should be improved, as lots of changes can’t be found in the documents or the RSSVersion.h
Such as FormatRecord api, for my situation, this api is much more convenient than FormatRecords as I deal with only one record at a time, so I don’t need to create a new RecordList ptr.