cancel
Showing results for 
Search instead for 
Did you mean: 

Exporting Crystal Reports Word format (.doc) Missing?

dwilliams1
Explorer
0 Kudos

Our team has worked with Crystal Reports Runtime, CR for Visual Studio and the Crystal Reports viewer control in an internal application for a few years now. In the past few weeks we have been upgrading the application from a 32-bit to 64-bit process and, with this, have been starting to work with the new SP32 64-bit runtime.

Our current setup has us working with both the 32-bit runtime and 64-bit runtime to ensure a user's machine can handle both runtimes existing in the system at the same time without crashing or any errors (this will make the transition easier). The testing has gone fine so far but upon pushing to a first batch of test users, it has been discovered that the ability to export from the crystal report viewer as a Word Document (.doc) has been removed. Word Document exporting in a .rtf format still exists, however:

1. The formatting between what is seen in the CrystalReportViewer control and opening an .rtf differs (some lines/data doesn't display the same way) and..

2. We are not looking to remove that feature from users as it was found as useful and we are only looking for a 64-bit switch, not a change/removing of functionality

We have tried explicitly setting the 'AllowedExportFormats' in our code to 'All Formats' but that does not seem to enable to now disappeared .doc format.

I have been searching through the posts here to see if there is an answer to this specific case but haven't found anything that addresses it. Could it be the installation of both runtimes at the same time? Are we overthinking what is going on?

Any help is greatly appreciated.

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Hi D,

Thank you for reporting this and sorry for the delay.

I pinged our Developers last night and it's a issue, that Export option should still be available in both CR 2020 Designer and CR for VS, so I escalated it for a fix:

KBA - 3248841 - Crystal Reports 2020 and Crystal Reports for Visual Studio is missing Export to Word (.DOC extension)

Case: 666461/2022 / Crystal Reports 2020 and Crystal Reports for Visual Studio is missing Export to Word (.DOC extension)

To early to say when it'll be fixed in CR Designer.

For CR for VS it should be in SP 33, not sure when it's going to be released at this time...

Yes RTF is still there but there are minor differences

If you still want to use it you can create your own Export button and use this code:

if (ExportTypeSelected == "crReportExportFormatMSWord") // crReportExportFormatEditableRTF // crReportExportFormatRTF
#region EditableDoc
{
    // This works do not alter
    // this gets the report name and sets the export name to be the same less the extension
    string outputFileName = "";
    string MyRptName = rpt.FileName.ToString();
    outputFileName = MyRptName.Substring(9, rpt.FileName.Length - 9);
    outputFileName = outputFileName.Substring(0, (outputFileName.Length - 3)) + "doc";

    try
    {
        if (File.Exists(outputFileName))
        {
            File.Delete(outputFileName);
        }

        CrystalDecisions.ReportAppServer.ReportDefModel.RTFWordExportFormatOptions RasDOCExpOpts = new RTFWordExportFormatOptions();

        try
        {
            RasDOCExpOpts = rptClientDoc.get_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatMSWord);
        }
        catch (Exception ex)
        {
            btnSQLStatement.Text = "ERROR: " + ex.Message;
            //return;
        }

        // Save the udpated info
        if (RasDOCExpOpts != null)
        {
            try
            {
                if (RasDOCExpOpts != null)
                    rptClientDoc.set_SavedExportOptions(CrReportExportFormatEnum.crReportExportFormatMSWord, RasDOCExpOpts);
            }
            catch (Exception ex)
            {
                btnSQLStatement.Text = "\nERROR: " + ex.Message;
            }
        }

        CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions exportOpts1 = new CrystalDecisions.ReportAppServer.ReportDefModel.ExportOptions();
        exportOpts1.ExportFormatType = CrReportExportFormatEnum.crReportExportFormatMSWord;
        exportOpts1.FormatOptions = RasDOCExpOpts;

        // And Export
        try
        {
            rptClientDoc.PrintOutputController.ExportEx(exportOpts1).Save(outputFileName, true);
        }
        catch (Exception ex)
        {
            btnSQLStatement.Text += "\nERROR: " + ex.Message;
        }
        MessageBox.Show("Export to Word Completed", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
    }
    catch (Exception ex)
    {
        btnSQLStatement.Text += "ERROR: " + ex.Message;
        return;
    }
}
#endregion EditableDoc

Thanks again

Don

dwilliams1
Explorer
0 Kudos

Thanks Don,

We appreciate the feedback, we look forward to SP33. For now it is not an issue to remain on SP31.

During some testing this morning we did notice that, although the .doc options was gone when exporting from the viewer in SP32, the actual file produced was still a .doc file when selecting Microsoft Word (RTF) (albeit oddly named fileName.rtf.doc). It did seem to maintain much of the formatting/lines that our users liked that was gone from the Microsoft Word (RTF) - Editable.

In the meantime, we have been trying to use the SP31 32-bit and 64-bit runtimes with the SP32 CR for Visual Studio but it is initially failing when opening reports in Visual Studio. Should this be possible to pull off or are the SP32 runtimes required for the Visual Studio integration to work?

Answers (1)

Answers (1)

dwilliams1
Explorer
0 Kudos

Our team was able to resolve this so going to share here so it can help anyone else. It seems with Crystal Reports Runtime SP32, both 32-bit and 64-bit, the ability to export to .doc files (using the CrystalReportViewer control) has been removed. The new options available are:

- Microsoft Word (RTF) (*.rtf)
- Microsoft Word (RTF) - Editable (*.rtf)

Previously (with Crystal Reports Runtime SP32) the available options were:

- Microsoft Word (97-2003) (*.doc)
- Microsoft Word (97-2003) - Editable (*.rtf)

Staying with the new options is not ideal as majority of the formatting is lost. For now, not ideal. We are reverting to the SP31 to maintain the ability to export to .doc.

It should be noted that if you have SP31 runtime downloaded in 32-bit then install the SP32 runtime in 64-bit, the 32-bit runtime seems to still have its exporting options changed to not support .doc. This still happens when running an application in 32-bit mode where it is working exclusively with the 32-bit runtime. Not sure if this is intended behaviour.