Reporting Services Error: The following bookmark cannnot be found in the template

Problem

When rendering an OfficeWriter for Word Reporting Services report, after removing all bookmarks from the template for a specific data source, the following error occurs:

Reporting Services Error ---------------------------------------------------------- An error occurred during rendering of the report. (rrRenderingError) Get Online Help An error occurred during rendering of the report. WordWriter Error: The following bookmark can't be found in the template: DataSourceName The following bookmark can't be found in the template: DataSourceName -------------------------------------------------------------------------------- SQL Server Reporting Services 

For example, someone may decide to remove a table of data from their report which they no longer want to display. To do this, they would delete the table, thereby removing the merge fields in it and the bookmark around the table row that defined the Selection Query Range for that data source.

Solution

As mentioned above, this error occurs when a Selection Query Range is defined for a data source and then removed from the template. Once a Selection Query Range for a data source is added to the template using the OfficeWriter Designer toolbar, a bookmark is added to the template to define what portion of the document should repeat and that data source is linked to the template in the report’s RDL file. If all the bookmarks for this data source are then removed from the template, the references to that data source in the RDL file that the Designer added are not automatically removed.

This behavior is planned to change in a future version, so that it will be possible to define a Selection Query Range for a data source in a template, and then later decide to remove it. In the meantime, there are two workarounds to this issue:

Remove the relevant block from the RDL for the data source that is no longer used

Important: Back up your RDL file before making manual changes to it in case you make a mistake.

For each data source used in the template, the OfficeWriter Designer adds a DataSourceName">... block in the RDL file.

If a data source is no longer used in the template, simply open the RDL file in a text editor and remove the correspoding Table block.

For example, if you want to remove this block for a data source called Contacts, look for the ... block and delete it.

Design your report from scratch

Build a new report from scratch (both RDL and Word template). When designing the template, be careful to only add Selection Query Ranges for data sources that will definitely be used in the report. (Don’t plan on removing all the bookmarks for any data source.)

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

Documents generated by WordWriter do not print

Problem

Using WordTemplate or WordApplication, the document is generated and opens in Word. But when you try to print the file in Word, nothing happens. There are no error messages, the printer just does not start printing.

Solution

There are several possible reasons for why a WordWriter-generated document will not print:

Document contains an image that is set to “Behind text”

If the template file contains an image that is formatted to be behind text, then this issue was addressed in WordWriter 3.9.2. The recommended solution is to upgrade to the latest version of WordWriter.

If upgrading is not an option, then a possible workaround is to set the image as a watermark, so it will appear behind the text of the document:

Word 2007/2010:

  1. Go to the Layout tab.
  2. In the Page Background tab group, go to the Watermark dropdown.
  3. Select Custom Watermark.
  4. Select Picture watermark.
  5. Select the image that you want to appear behind the text.

Word 2003:

  1. Go to Format
  2. Go to Background
  3. Go to Printed Watermark
  4. Select the image that you want to appear behind the text

MS Word Background Printing Option

There is a known issue with some WordWriter-generated documents and the Background Printing option in MS Word. If your WordWriter-generated documents do not print or trying to print those documents results in error messages, try turning off Background Printing as described in this post.

OfficeWriter Designer toolbar is not visible in Excel or Word

Problem

After installing the OfficeWriter Designer, the Designer Add-In is not available in Excel/Word. This may occur if:

  • The OfficeWriter Designer installer was not run
  • The Designer was not installed properly
  • The Designer is currently disabled.

Solution

To run the OfficeWriter Designer installer

The OfficeWriter Designer is a component that is redistributible and does not require a license key. There is a separate installer for the OfficeWriter Designer.

The Designer installer is available for separate download from http://www.officewriter.com/product-updates or upon request.

To check if the OfficeWriter Designer was installed correctly:

Make sure that hidden folders are visible:

  • Open a folder and go to Folder options
  • Under ‘Files and Folders’ locate ‘Hidden Files and Folders’
  • Select ‘Show hidden files and holders’

Check the ApplicationData\Microsoft start directories for the Add-In files:

  • For Excel: look for SAExcelTemplateAddIn.xlam in Application Data\Microsoft\Excel\XLSTART
  • For Word: look for SAWordTemplateAddIn.dotm in Application Data\Microsoft\Word\STARTUP

If the files are there, the OfficeWriter Designer was installed correctly, but might be disabled. See below for how to re-enable the Designer if it’s been disabled.

If the files are not there, then the OfficeWriter Designer was not installed properly. Try uninstalling the OfficeWriter Designer through Add/Remove programs and try to re-install.

How to re-enable the Designer if it has been disabled:

Office 2007/2010:

  • Go to the Office menu button (2007) or File tab (2010) in the upper left hand corner.
  • Click Excel/Word Options
  • Select Add-Ins from the left menu
  • At the bottom, select ‘Disabled Items’ from the ‘Manage’ drop-down menu.
  • Click Go
  • If the OfficeWriter Designer is there, select and click Enable.

Office 2003:

  • Go to the Help menu and select About Microsoft Office Excel/Word
  • Click Disabled items*
  • If the OfficeWriter Designer is listed, select and click Enable.

Things Learned at SPTechCon

[Striking a pose with the Hillbilly. Pre clog-off.]

1. The lack of readily available caffeine was kind of a problem,

2. A lot of the attendees we met were about to take the SharePoint plunge, and we salute your courage. But also, learning your way around won’t be that difficult – it only appears that way.

3. Dux was so right when he said we need to stop thinking about SharePoint as a solution and start thinking about it as a platform. (Upon which anything is possible. Almost.)

4. People are totally willing to fill out a survey if you ply them with SD cards

5. The SharePoint Hillbilly is just as nice in person as he seems on his blog. Actually, sometimes he seems cranky on his blog—but then again, when we met him, he’d just won an iPad.

6. Planking has nothing to do with SharePoint. But a lot to do with SharePints.

7. You don’t have to watch Jersey Shore to see a staged fight. Continue reading Things Learned at SPTechCon

Developing Android Apps: 10 Performance-Boosting Strategies

In working on my spare-time app BostonBusMap, I’ve repeatedly run into problems where I need to cut down on memory usage or running time. It’s not difficult to hit memory limitations on Android, especially on earlier devices which may allow only 16MB per app. Garbage collection can cause noticeable hiccups (especially before Android 2.3), which is one reason why memory usage can impact an app’s sluggishness. Here’s a list of things I did to make my app more responsive:

  1. First, read the Android performance guidelines. It’s also worth rereading this page from time to time because newer Android versions have more advanced capabilities that may influence the optimizations you make.
  2. One other important thing that bears repeating from that page is, don’t optimize unless you can show that there’s a bottleneck, because optimizing is a lot of work and can make code less maintainable
  3. Memory allocations are expensive. Be lazy in allocating objects if they are only used in edge cases
  4. Use DDMS. This is available within Eclipse and as a standalone tool:
    1. Profile against smaller amounts of data at first, to make the experience less painful and time consuming for you. Debugging will slow your app down in general
    2. Click on the green cylindrical icon to the left (called “Update Heap”) to turn on heap tracking for a thread. This will update whenever a garbage collection occurs (you can also force garbage collections) Continue reading Developing Android Apps: 10 Performance-Boosting Strategies

Error: Could not load file or assembly ‘vsjlib, Version=1.0.3300.0’

Problem

After migrating to the .NET 4.0 Framework, an OfficeWriter application throws the error:

Could not load file or assembly ‘vjslib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

Solution

OfficeWriter 3.x relies on the J# runtime, so users who have tried using OfficeWriter 3.x with Visual Studio 2010 and the .NET 4.0 Framework have run into issues. This is due to the fact that Microsoft does not have a version of the J# runtime for .NET 4.0.

There are two possible solutions:

#1: Update to OfficeWriter 4.x or later (recommended)

The J# runtime dependency was removed in OfficeWriter 4.0.0, so upgrading to OfficeWriter 4.x or later resolves the issue. We recommend upgrading because all new features and bug fixes are released in the latest version of OfficeWriter.

#2: Downgrade to an earlier version of .NET

For .NET versions 2.0 or 3.0, Microsoft has a J# redistributable package available for 32-bit and 64-bit systems. Microsoft also has a redistributable package of J# for .NET Version 1.1.

NOTE: OfficeWriter 3.x is no longer supported. OfficeWriter Supported Versions Policy

Reporting Services Error: Could not load file or assembly ‘x’ or one of its dependencies

Problem

You want to use a newer version of ExcelWriter or WordWriter with OfficeWriter’s Reporting Services integration. A common scenario is upgrading to an intermediate build of ExcelWriter or WordWriter which fixes a bug or adds a new feature.

To provide context, OfficeWriter’s Reporting Services integration consists of the following components:

  • ExcelWriter (SoftArtisans.OfficeWriter.ExcelWriter.dll)
  • WordWriter (SoftArtisans.OfficeWriter.WordWriter.dll)
  • A custom rendering extension (SoftArtisans.OfficeWriter.RS2008.dll for SQL Server Reporting Services 2008)

When upgrading to a different version of ExcelWriter or WordWriter, normally you also have to upgrade to the matching version of the custom rendering extension. This is because the custom rendering extension is built against a specific version of ExcelWriter and WordWriter and only works with that version. If the version of ExcelWriter or WordWriter does not match the version of the custom rendering extension, you will get this error when exporting the report using ExcelWriter or WordWriter:

Could not load file or assembly ‘x’ or one of its dependencies. The located assembly’s manifest definition does not match the assembly reference.

If you are performing a regular upgrade in which you replace the custom rendering extension DLL as well as the ExcelWriter or WordWriter DLL, use the manual installation instructions as a guideline.

However, if there are no changes to the custom rendering extension, it is convenient to use the same custom rendering extension DLL and replace just the ExcelWriter or WordWriter DLL. This approach also allows you to easy test any version of the ExcelWriter or WordWriter DLL. In this case, follow the below instructions.

Solution

To upgrade the ExceWriter or WordWriter DLL without having to replace the custom rendering extension, you can create an assembly binding redirect so that request for the old DLL are redirected to the new DLL.

The solution is also applicable to any ASP.NET application for which you want to replace a dependent assembly with another version. Use the instructions below as guidelines for making modifications to the application’s web.config.

The process for creating an assembly binding redirect is slightly different for ExcelWriter and WordWriter, because by default WordWriter is installed into the Global Assembly Cache (GAC).

Upgrading ExcelWriter

1. Navigate to the Reporting Services directory, typically `DRIVE:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services’

2. Copy SoftArtisans.OfficeWriter.ExcelWriter.dll to ReportServer\bin, replacing the existing DLL

3. Determine the version of the new DLL; for example, 7.5.1.2770

4. Edit ReportServer\web.config and add the following section under the section:

XML Config Script

 <configuration>     <runtime>         <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">             <dependentAssembly>                 <assemblyIdentity name="SoftArtisans.OfficeWriter.ExcelWriter" publicKeyToken="f593502af6ee46ae" culture="neutral" />                 <bindingRedirect oldVersion="7.5.0.1-7.5.1.9999" newVersion="7.5.1.2770"/>             </dependentAssembly>         </assemblyBinding>     </runtime> </configuration> 

Note: If there is an existing section, add only the  section inside it, so that there is only one assembly binding definition.

In the example above, set the newVersion attribute to the version of the new DLL. Set the oldVersion attribute to a single version or a range of versions which are to be mapped to the new version.

5. Perform the same steps for ReportServer\bin\ReportingServicesService.exe.config

6. Restart the Report Server

Upgrading WordWriter

If WordWriter is installed in the GAC, as done by the installer, you must also install the new DLL into the GAC. Because the GAC supports multiple versions of a DLL, you do not have to uninstall the old DLL. However, by using assembly binding redirect, you can force Reporting Services to use the new DLL. Follow the procedure below to upgrade WordWriter:

1. Install the new DLL into the GAC using, for example, the gacutil tool.

2. Navigate to the Reporting Services directory, typically ‘DRIVE:\Program Files\Microsoft SQL Server\MSRS10.MSSQLSERVER\Reporting Services’ Copy SoftArtisans.OfficeWriter.WordWriter.dll to ReportServer\bin

3. Determine the version of the new DLL; for example, 4.5.1.1648

4. Edit ReportServer\web.config and add the following section under the section:

XML Config Script

 <configuration>     <runtime>         <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">             <dependentAssembly>                 <assemblyIdentity name="SoftArtisans.OfficeWriter.WordWriter" publicKeyToken="f593502af6ee46ae" culture="neutral" />                 <bindingRedirect oldVersion="4.5.0.1-4.5.1.9999" newVersion="4.5.0.1567"/>             </dependentAssembly>         </assemblyBinding>     </runtime> </configuration> 

Note: If there is an existing section, add only the section inside it, so that there is only one assembly binding definition.

In the example above, set the newVersion attribute to the version of the new DLL. Set the oldVersion attribute to a single version or a range of versions which are to be mapped to the new version.

5. Perform the same steps for ReportServer\bin\ReportingServicesService.exe.config

6. Restart the Report Server

If WordWriter is not installed in the GAC, skip step 1 and follow steps 2-7 in the above procedure.

Designer Compile Error: Object library invalid or contains references that cannot be found

Problem

When the OfficeWriter Designer is installed, Excel or Word throws a VBA compilation error:

Object library invalid or contains references that cannot be found.

This error can occur if you installed a version of Office on a system in which the Office Designer had already been installed for a different version of Office. For example, you were using OfficeWriter Designer with Office 2007, then later installed any component of Office 2010, including SharePoint Designer 2010 (which is a part of the Office Suite). The error does not go away even if you uninstall one Office version.

This problem will not occur if you install OfficeWriter Designer for the first time on a system which is already running two versions of Office side-by-side.

The error is thrown at startup when Excel or Word attempts to load the add-in template which contains the VBA code for the OfficeWriter Designer. Excel or Word is attempting to use a cached, incompatible version of certain Microsoft control type libraries.

Solution

Resolve the error by removing all cached control type libraries as follows:

  1. Close all running instances of Excel or Word
  2. Navigate to \users\USERNAME\appdata\roaming\microsoft\forms
  3. Remove all *.exd files
  4. Start Excel or Word. Upon starting, the compatible version of the required .exd files will be automatically restored.

Update 4/10/2012: This issue might also occur if you installed the Microsoft April 2012 security update on a machine that had the OfficeWriter Designer installed. For more details about the April 2012 security update specifically, please refer to Microsoft’s kb article.

Update 8/12/2012: Similar issues may be the result of the August 2012 security update. If following the steps listed above do not resolve the issue, please try following the steps listed in this OfficeWriter kb article.

Blogged