Dealing with obsolete versions of RTF - mfc

Summary questions:
Do you know of a lightweight application that can save files in RTF Version 1.6 format?
Do you know what version of RTF Abiword's "Rich Text Format for old apps" corresponds to?
Do you know a way to inspect an RTF file and determine what version of RTF it's encoded under?
Do you know which DLL describes the RTF format on a Windows NT 4.0 machine and whether it can be upgraded?
I have a legacy MS Visual C++ 6.0 MFC application that runs on an embedded Windows NT 4.0 machine. The application provides in-app help using MFC's CRichEditView class to pull text out of an RTF file called help.rtf. The help file is saved as RTF version 1.6. It has always been edited using MS Word 2000 or the version of WordPad that comes with Windows NT 4.0.
The problem is that our developer workstations tend to have Windows XP (and its version of WordPad) and Office 2003 or better, both of which use more recent versions of RTF than 1.6, and it is becoming increasingly cumbersome to find a machine on which the file can be edited and re-saved in that obsolete format. If a newer version of Word or WordPad is used to save the file, it gets saved as a newer version of RTF. Then, when the application is run on the NT machine, the help text doesn't display properly. (Although when the same application is run on an XP machine, the help text does display properly.)
So, I'm looking to do one of two things:
Find an application (preferably lighter-weight than Word 2000) that will save files in RTF version 1.6 format, that we can use for future editing of the help file.
Figure out a way to get the NT machine to read later versions of RTF properly.
On the first front, I've tried AbiWord, which has a "Rich Text Format for old apps" option, but I can't tell what version of RTF this option outputs. Do you know what version this is? Unfortunately, it's not readily apparent from the metadata in the file, which just says "rtf1", per this cute passage from all versions of the RTF spec. Is there a way to analyze an RTF file and determine what version of RTF it's encoded under?
The RTF standard described in this RTF Specification, although titled as version 1.6, continues to correspond syntactically to RTF Specification version 1. Therefore, the numeric parameter N for the \rtf control word should still be emitted as 1.
On the second front, I'm wondering if there's some DLL that I can just update so that Windows NT will recognize the newer version of the format. Do you know which DLL describes the RTF format and whether it can be upgraded?

I believe the rich edit format is determined by the rich edit control itself. I wouldn't try to upgrade the DLL, because there's a lot that could break.
See this MSDN note for hints on using the later version of the rich edit control. Version 2.0 should be available in NT 4.0.
http://msdn.microsoft.com/en-us/library/tt1cfb9f(VS.80).aspx
You might try copying the version of WordPad from your NT system and see if that works as an alternative.

Following a chain of hints that started with Mark Ransom's answer, I ended up copying riched20.dll and riched32.dll from C:\Windows\System32\ on my XP machine to C:\WinNT\System32\ on the NT machine. After I did this, RTF files edited with WordPad or Word on the XP machine rendered correctly on both WordPad and my application on the NT machine.

First thing that comes to mind is WordPad. It's on every machine and is really lightweight in it's RTF. I've found it much better than Word at many simple RTF tasks.

Related

PowerBI api powerbi.js error on firefox

I have a product on Microsoft store (PowerBI Tiles), that use the api powerbi.js from Microsoft to get visuals from logged-in user.
When I try to open the application using PowerPoint online on Firefox, we got some problems.
"The character encoding of the plain text document was not declared. The document will render with garbled text in some browser configurations if the document contains characters from outside the US-ASCII range. The character encoding of the file needs to be declared in the transfer protocol or file needs to use a byte order mark as an encoding signature."
My team try to solve the problem on our side, but we detect that the problems doesn't come from our code, but from powerbi.js (Microsoft code). Even the demos from Microsoft doesn't work on Firefox.
We create two animated gifs reproducing the problem (on our application and also on the demos from Microsoft)
Microsoft Demos - Running on Firefox
PowerBI Tiles - Running on Firefox
Anyone with this kind of problem? Any solution to this problem.
Many thanks.
João

Railo 4 - which document formats are supported by Cfindex / Lucene?

I thought i had a simple question, but somehow i cant find a source for the answer....which document formats can be indexed by the Lucene version that is packaged with Railo 4.0?
Somehow .doc and .pdf seem to go well, but docx and rtf just don't seem to get indexed....Is there a list available somewhere? And for all formats that arent supported, what would be the best way to get that info indexed aswell by cfindex?
<cfindex
collection = "#collection#"
action = "update"
type = "file"
key ="#ABSfilepath#"
title="#ABSfilepath#"
>
thanks!
Question also posted to Railo mailing list: web link.
Railo 4 uses Lucene 2.4.1 - how do you tell? Same way you tell the version for all third-party software that Railo uses: locate the JAR file (in the lib/ext directory), open that archive (using 7-zip or equivalent), and look at META-INF/MANIFEST.MF where you find content like this:
Specification-Title: Lucene Search Engine: core
Specification-Version: 2.4.1
Specification-Vendor: The Apache Software Foundation
Implementation-Title: org.apache.lucene
Implementation-Version: 2.4.1 750176 - 2009-03-04 21:56:52
Implementation-Vendor: The Apache Software Foundation
This seems to be a pretty old version and doesn't look like it has any docs on the Apache Lucene website. (It might be possible to upgrade Lucene by replacing the relevant JARs, but this might also cause dependency issues; do at own risk.)
Since the Lucene website doesn't help, a search for "lucene 2.4.1 indexable documents" brings back a pertinent question about v2.3.2 which asks:
Does Lucene java supports parsing of extensions *.docx, *.pptx, *.mpp i.e.
Microsoft Windows 2007 documents?
With the response:
Lucene doesn't actually support any of the document types. What happens
is that some program is used to parse the files into an indexable stream
and that stream is indexed. That used to be POI in the old days.
Ok, so assuming that is still accurate, Lucene doesn't control the filetypes, Apache POI does.
Checking the JARs tells us Railo 4.0 uses Apache POI v3.8 and looking at the POI changelog reveals that .docx support arrived in v3.5
So, your .docx files should be supported along with the other MS Office formats. If it's definitely not being indexed, you probably need to identify if it's a POI issue or a Lucene issue or a Railo issue - creating a simple reproducable test case with both .doc and .docx documents is probably a good first step.
Beyond that, you'll need someone familiar with Lucene/POI to advise - there may or not be log files that will contain details of possible indexing/retrieval errors, or ways to interact with Lucene directly (not via Railo/cfindex) that can help identify where the issue lies.

Use PDF Core Fonts in wkhtmltopdf/QPrinter

Questions in a nutshell:
Is it possible to force wkhtmltopdf to use Type1 fonts (PDF core fonts) when generating the pdf?
or: Is it possible to force the Qt QPdfEngine to use Type1 fonts (PDF core fonts) when generating the pdf?
Detailed description of the problem.
I have developed a webapp to do a pdf-export of a very large database using wkhtmltopdf & tcpdf. The (900+) pages are "printed" using wkhtmltopdf and then "glued together" using tcpdf & fpdi.
Unfortunately wkhtmltopdf seems to always embed the fonts it uses to render the pdf. This is very unwanted behavior as this is redundant and bloats the document. Additionally the document needs to be editable in Acrobat Pro. Apparently Acrobat Pro seems to be overwhelmed by embedded fonts. It tries to replace them upon saving the document, and hangs itself after ~45 minutes on windows machines (on Mac machines it just takes incredibly long to save the document).
So: is there a possibility to tell wkhtmltopdf not to embed fonts and use Type1 Fonts (Helvetica) instead?
I couldn't find any switch to do this so i assumed patching wkhtmltopdf would do the trick by using: printer->setUseEmbeddedFonts(false)
Unfortunately this didn't change anything.
My next idea was patching the Qt-PDF-Printer. Looking into the QPrinter-Class and the QPrintEngine I didn't find any place where the pdf engine uses Type1 fonts instead of embedding the TTF-Fonts (or whatever font is used).
Any ideas and/or pointers?

MS Word/ ODF Automation in Qt

How can I perform automation of MS Word documents (.doc) or ODF documents (.odt) in Qt 4.5? I know using the QAxWidget, QAxObject.
I have data (QString) and few images as well. I have to add them into the document. I googled but I couldn't find any commands for MS- Word/ ODF. But I want the specific commands that should be passed in QAxObject::dynamicCall() function to perform my operations.
For e.g in MS Excel we have to use something like,
excel.querySubObject("ActiveWorkBook");
which will return the object of the Active workbook of the Excel document.
What are all the commands that are available for the generation of MS-Word or ODF (odt) documents? I am using Windows XP. Any links, examples are welcome..
Take a look at http://doc.trolltech.com/qq/qq27-odfwriter.html, Qt provides functionality to create OpenDocument Format (ODF) files.
The ActiveX commands related to the MS Word can be obtained by the VBAWD10.chm that is being installed along with MS - Word.
The details of the ActiveX help documents available can be obtained here.
The toughest part is to conform those in such a way that it can accessed through the ActiveQt Module.
I provided a similar solution to my question here
Hope it helps for those who are all looking similar solutions..

Is there any C++ lib to read thumbnails from thumb.db in Windows Folder?

I want to read all thumbnails from a folder with images in Windows XP.
But if I read image file to get thumbnail, it seems a bit slow, so I wish I can first read the windows image thumbnail cache:thumb.db.
Is there any lib in c++ or c to read thumbnails from thumb.db.
The Thumbs.db file is stored in OLE Compound Document format, the same format that many Microsoft Office products use.
You could also try to look into ThumbsDBLib. It is in C# but you can probably see what they do to read the data and convert it to C++.
Note: Windows Vista and later doesn't use Thumbs.db. See the IThumbnailCache interface for Vista and later.
For Vista and later they are stored here: %homedrive%\Users\%username%\AppData\Local\Microsoft\Windows\Explorer
You might find this useful:
ThumbsDBLib in C++
http://www.windameister.org/blog/index.php/thumbslib-in-cpp