Tag Archives: knowledge base

Designer Install Error: No Office 2007 or 2010 found

Problem

Installing the OfficeWriter Designer 8.1.0 and higher throws the error:

No Office 2007 or 2010 found. Office 2007 or later must be installed to use this product. If you are using an earlier version of Office please download the installer version 8.0 or earlier.

Solution

Office 2010 is installed

This error may occur if you have the 64-bit version of Office 2010 installed.

The OfficeWriter Designer does not currently support the 64-bit version of Office 2010. There are no immediate plans to support the 64-bit version of Office 2010 because we have not seen much demand from customers and Microsoft recommends using the 32-bit version in most cases:

IMPORTANT The 32-bit version of Office 2010 is the recommended option for most people because it prevents potential compatibility issues with other 32-bit applications, specifically third-party add-ins that are available only for 32-bit operating systems. — Choose the 32-bit or 64-bit version of Microsoft Office.

The OfficeWriter Designer is supported on 64-bit operating systems, but requires a 32-bit version of Office. If no 32-bit version of Office 2007 or 2010 is detected on the machine, the installer will throw the error above.

Office 2003 is installed

Starting in OfficeWriter 8.1, the OfficeWriter Designer is only supported in Office 2007 and 2010. If you need to use the Designer in an earlier version of Office, please download OfficeWriter Designer 8.0 or earlier.

No Office is installed

The OfficeWriter Designer is an Office add-in and requires a 32-bit version of Office to be installed.

Error: BC3002: Type ‘WordTemplate’ is not defined

Problem

When working with a dynamically compiled aspx page (meaning that it does not have a code behind aspx.cs or aspx.vb page), the following error message may occur:

Compiler Error Message: BC30002: Type ‘WordTemplate’ is not defined

The error is thrown on the line that instantiates the WordTemplate object.

Solution

Note: Although the error message lists WordWriter, this applies to ExcelWriter as well.

Most customers have precompiled web applications or web sites, which means that the site is precompiled from Visual Studio with references to any necessary DLLs, including SoftArtisans.OfficeWriter.ExcelWriter.dll or SoftArtisans.OfficeWriter.WordWriter.dll. For more information on how to add OfficeWriter to a precompiled .NET application, see Adding OfficeWriter to your .NET Application.

However, if working with dynamically compiled pages, the references aren’t added ahead of time. The sample principles for precompiled applications apply here as well:

  1. Make sure to import or include the SoftArtisans.OfficeWriter.WordWriter (or SoftArtisans.OfficeWriter.ExcelWriter) namespace.
  2. Make sure to import the System.Web namespace because the ExcelWriter and WordWriter output options have a dependency on System.Web.
  3. Make sure that SoftArtisans.OfficeWriter.WordWriter.dll or SoftArtisans.OfficeWriter.ExcelWriter.dll is in the bin directory of the application. The alternative is to install the DLL into the GAC.

ExcelWriter Error: Resulting sheet would have more rows than are permitted by the Excel format

Problem

The Excel .xls binary format has a limit of 65536 rows per worksheet. If you are importing data with ExcelWriter’s ExcelTemplate object (or our SSRS renderer, which uses the ExcelTemplate object) it is possible to get an error that Excel’s row limit was exceeded even though you know you have imported much fewer than 65K rows.

This problem is usually caused by cells or formulas that already exist in the template file. When ExcelWriter populates a spreadsheet with the ExcelTemplate object, it inserts a new row for every row of data and pushes all existing rows down. If the total number of pushed down rows plus inserted rows exceeds Excel’s limit, an exception will be thrown. Then, after the data has been imported, ExcelWriter goes through the entire workbook and updates any formulas that reference the data marker cells, stretching the formulas to include all the newly inserted rows. If the cell range in a formula is stretched beyond Excel’s row limit, again an exception will be thrown.

Solution

Cells

Sometimes people take a previously populated report and turn it into a template. They may have cleared the cell values, but the template may still contain many rows of cells that are blank or contain only formatting. These rows will be pushed down when the data is imported.

The solution is to clean up the template file by actually deleting all unnecessary rows and columns rather than just clearing cell values. Also, it’s generally a good idea to set background formatting using row or column headers rather than by selecting large areas of cells.

Formulas

Formulas can be found in many parts of a workbook, including cells, charts, conditional formatting, and named ranges. Make sure that all formulas reference the minimum number of rows necessary and bear in mind that ExcelWriter will stretch certain formulas when new rows are inserted.

Hidden named ranges

It is important to know that Excel sometimes creates hidden named ranges behind the scenes for internal purposes. You won’t be able to find them through the Excel UI, but if they reference data marker cells, ExcelWriter will update them. Common cases where Excel created hidden named ranges are when the user applies an AutoFilter or AdvancedFilter to a range of cells. This occurs whether the filter is applied from the Excel UI or from a VBA macro. For this reason, check your macros carefully to make sure they are not applying any filters to unecessarily large cell ranges that include data markers. If you have any unnecessarily large hidden named ranges in your macros, you can modify them by changing the VBA code and running the macro again. If you are having trouble modifying or removing hidden named ranges, you can write some VBA code to do it. The names always end in “`_FilterDatabase”

Tip: If you have Excel 2007 or above, here is a quick way to see if you have any hidden named ranges in an .xls file without writing any VBA:

  1. In Excel, save a copy of the template file as .xlsx or .xlsm
  2. Rename to .zip and unzip the file
  3. In the subdirectory “xl”, open the file workbook..xml
  4. Look in the Section
  5. Look for defined names that end in “_FilterDatabase”. Here is an example of something you might see: <definedName name="xlnm.FilterDatabase” localSheetId=”3″ hidden=”1″> Data!$A$1:$BQ$65000
  6. If you temporarily change hidden to 0, it will show up in Excel under the named item manager.

Note: We don’t recommend permanently modifying or removing these hidden named ranges in the XML directly as that could have unexpected results.

Word Error: Could not start converter mswrd632.wpc

Problem

When you try to save a Word 2007 template as part of a SQL Server Reporting Services RDL you get an error:

Word cannot start the converter mswrd632.wpc

Solution

This error is caused by a Windows security update published December 2009, affecting Windows XP, Windows 2000 and Windows Server 2003. You can resolve the issue by disabling the converter through the registry. Open regedit and delete the registry keys at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters\Import\MSWord6.wpc. Restart Word and the error should disappear.

You can find more information in this article. It also provies a script that will perform the registry fix for you. The additional steps mentioned in the update to that article have not been tested, as unregistering the converter has solved the problem in every instance in which we’ve encountered it.

Note that this issue only affects Word 2007 SSRS templates. Word 2003 templates are not affected. Also, Excel 2007 is not affected by this issue.

Designer Error: Type Mismatch

Problem

Selecting Open Report in the OfficeWriter Designer toolbar in Excel displays a type mismatch error.

The type mismatch error occurs when a client machine is configured with regional settings that cause Excel to return it’s version number in a format the designer does not expect. For example, French regional settings by default use the space (” “) digit grouping symbol.

Solution

Option 1: Upgrade (recommended)

This issue has been fixed in the OfficeWriter Designer version 4.6.1 and later without the need to adjust regional settings.

Option 2: Adjust the current regional settings for the OS

Navigate to the systems control panel > regional settings. Depending on your operating system this may appear as:

  • Region and Language
  • Date, Time, Language, and Regional Options
  • Select either Customize or Advanced settings

Change the Digit grouping symbol to “.” excluding quotes, or other symbol that does not cause an error. Then apply changes.

Large documents generated by WordWriter do not print correctly

Problem

At least two specific separate issues may be caused by Background Printing, an optional feature of Microsoft Word, when printing a long WordWriter-generated document. The first causes Word to report upon opening that there are errors in the document and to ask to repair them; words are then omitted from the printed file and Word crashes while printing. The second causes Word to print only the first few pages of a large document.

Solution

Background Printing in Word allows you to continue working in Word while the program is sending a large file to the printer. Unfortunately, it causes a number of issues with some long WordWriter-generated files, as described above. The only effective workaround for these problems is to turn off background printing in Word. To turn off Background Printing, follow these steps:

Word 2007/2010

  1. Go to the Office button (2007) or File tab (2010)
  2. Select Word Options (2007) or Options (2010)
  3. Go to Advanced and then to the Print section
  4. Uncheck Print in background

Word 2003

  1. Go to Options
  2. Go to the Print tab and then to the Printing Options section
  3. Uncheck Background Printing

FitToPagesTall and FitToPagesWide settings do not take effect

Problem

FitToPagesTall and FitToPagesWide settings do not take effect unless Zoom is explicitly set to false.

Solution

FitToPagesTall, FitToPagesWide and Zoom are properties of the PageSetup object of the ExcelWriter Application object.

The Page Setup dialog in Microsoft Excel allows you to select one of the following two options:

  1. Adjusting the worksheet so that it fits to the dimension of “x” number of pages width-wise and/or length-wise.
  2. Adjusting the worksheet so that it prints to a certain percentage of the original size, ranging between 10 and 400 percent.

The equivalent properties in ExcelWriter are:

The Zoom property has a default value of “True” and “100” percent. This means that even if the Zoom is not explicitly set in your code, these values will be assumed. Any values provided for FitToPagesTall or FitToPagesWide will be ignored. If you want to use these properties, you must explicitly change the value of Zoom to “False”:

worksheet.PageSetup.Zoom = false; worksheet.PageSetup.FitToPagesTall = 2; worksheet.PageSetup.FitToPagesWide = 2;

Install Error: System appears to have an unrecognized version of J#

Problem

The following error is returned while attempting to install OfficeWriter 3.9 or below:

The System appears to have .NET 2.0 and an unrecognized version of J#. Please install J# 2.0 if you wish to use ExcelWriter .NET or WordWriter.

Starting with version 4, OfficeWriter has been written completely in C# and no longer requires the J# runtime. However, customers installing version 3.x of OfficeWriter do need the J# runtime. The version of J# should match the installed version of the .NET framework.

Solution

Install the J# redistributable that matches the .NET framework that you are using in your application.

Note: Microsoft has not released a J# redistributable that matches .NET 4.0 framework. To use OfficeWriter with .NET 4.0, you will need to upgrade to OfficeWriter 4 or later.

Files generated by OfficeWriter do not open in the browser

Problem

When OpenInBrowser in the Save method is set to true, the Excel spreadsheet or Word document does not open in the Internet Explorer Browser window as expected. Instead, the spreadsheet opens in Excel or the document opens in Word.

Solution

Using a browser other than Internet Explorer

The plugin that is used to display Office files in the browser is only available in Internet Explorer, so other browsers cannot display Excel or Word files within the browser. However, you can set whether you want to always open the files in Excel or Word, or save them to disk by default.

Firefox:

When a user is sent an Excel or Word file, a dialog box prompting to Open or Save the file pops up. The user can choose an option and then check the “Do this automatically for files like this from now on” box to have it remember this choice.

Chrome:

Chrome defaults to saving the file to disk. If you want to open a file type automatically in Excel or Word, download a file of that type. Once the file is downloaded, right-click the file in the download bar at the bottom of the browser. Select “Always open files of this type”.

Using Internet Explorer

It is likely that the “Browse in Same Window” is disabled for the file types (XLS, XLSX, XLSM, DOC, DOCX, DOCM).

Previously, this option was available under Folder Options > File Types > Select a file type > Check Browse in the same Window.

Starting in Windows Vista, this option is no longer exposed and the registry needs to be modified to enable certain file types to open in the browser. This Microsoft Knowledge Base article explains how to enable the behavior by modifying the registry: A new window opens when you try to view a 2007 Microsoft Office program document in Windows Internet Explorer 7 or Internet Explorer 8.