Trendline Label doesn’t show Equation/R-squared value

Problem

It is possible, in Excel, to add a label to a trendline of a chart that shows the Equation or the R-squared value of the trendline like in the image below:

Trendlines can also be created as objects in ExcelApplication through the Series of a Chart. The Trendline object has the properties to ShowEquation and ShowRSquaredValue.

Setting these properties to true does not seem to have any effect and the label is not shown. However, if you open, with ExcelApplication, an existing workbook which already has a Trendline label these properties will work properly. From that point on you can programmatically change the label as you like using the properties.

Solution

This issue has been resolved for charts in the OOXML file format (XLSX, XLSM) as part of implementing OOXML support for ExcelApplication in OfficeWriter v8.0.

This issue persists for the BIFF (XLS) file format. It can be worked around in the following manner:

1. Create a new chart in Excel and add a trendline.

2. Add the Equation or the R-Square: Select the trendline then right-click the trendline or choose Format>Selected Trendline from the menu.

3. Now simply open the workbook with ExcelApplication.Open, retrieve the trendline and program it any way you like (Including changing the trendline regression type or value or show/hide the Equation or R-Squared value):

Trendline trend = oSeries.Trendlines[0]; //now this will work trend.ShowEquation = true;

Error: Cannot open PivotTable source file ‘[filename[x].xls]SourceData’

Problem

When opening an Excel file containing a pivot table that was streamed to an IE client, Excel will throw the following error message:

Cannot open PivotTable source file ‘[filename[1].xls]SourceData’

This is caused by IE caching the streamed file with a temporary name containing brackets (e.g. filename[1].xlsx). Since Excel does not allow pivot table data sources to contain brackets, when the cached file is opened, the pivot tables try to refresh using the temporary file name.

Solution

There are several ways to work around this:

  • Use a non-IE browser, such as Firefox or Chrome
  • Use IE 9 or later – this appears to have been resolved in the newer versions of IE
  • Save the file to disk before opening it to avoid opening the file with a temporary name
  • Stream the file inline instead of an attachment. This will open the file in IE’s Excel plugin instead of downloading it. If you are using IE 7 or later, you will need to configure the registry on the client to use this option.
  • Add Excel macros to the report to dynamically rename the PivotTable to exclude the bracket and then refresh the PivotTable. An example of these macros is available in this blog post.

Note: This is not an issue with the OfficeWriter product. This behavior occurs anytime someone attempts to download and open an Excel workbook with a PivotTable directly from certain versions of IE.

We have made these solutions available online because our customers have found the information helpful. However, these solutions are not covered under OfficeWriter product support. If you experience issues implementing any of these solutions, we encourage you to reach out to the appropriate vendor (i.e. Mozilla for Firefox, Google for Chrome, and Microsoft for IE 9 (or later) or to configure the in-line plugin).

In particular, if you encounter difficulties with the macro solution, feel free to leave a reply on the blog post so that the author of the post can address your concerns.

Error: WordWriter.dll was loaded by the DLLRegisterServer entry point was not found

Problem

When attempting to register WordWriter.dll with regsvr32, the following error is thrown:

C:\Program Files\SoftArtisans\WordWriter\WordWriter.dll was loaded, but the DLLRegisterServer entry point was not found. DLLRegisterServer may not be exported, or a corrupt version of C:\Program Files\SoftArtisans\WordWriter\WordWriter.dll may be in memory. Consider using PView to detect and remove it.”

Solution

Regsvr32 can be used to register COM objects, but not .NET ones. Because WordWriter is a pure .NET assembly, it does not need to be registered. To be used in a .NET application, WordWriter.dll can be placed in either the Global Assembly Cache (GAC) or in the application’s bin directory.

WordWriter can be used from standard ASP by registering its COM-callable wrapper, WordWriterCOM.dll. The COM wrapper is registered with regsvr32. For more information on using WordWriter in ASP, see the WordWriter documentation on Using WordWriter in ASP.

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.

Excel or Word file generated by OfficeWriter opens in protected view (yellow)

Problem

A report generated using ExcelWriter or WordWriter opens and there is a yellow warning banner saying that the file has been opened in Protected View.

Solution

Starting in Office 2010, Microsoft introduced a security feature that scans files before opening them in Excel or Word. If there is something wrong with the file format definition, it will open in Protected Mode with a red warning banner.

One of the common scenarios for opening a file in Protected View is opening the file from an unsafe location, such as the Temporary Internet Files folder. This means that if the file is streamed to an end-user, it will open in protected view.

For more information about Protected View settings in Office 2010, please refer to this Microsoft TechNet article on how to configure Protected View settings in Office 2010.

SPTechCon’s Top Tweets, Vol. 2

So tweeps at the ‘Con have definitely gotten past the point where I can keep up. Meaning, perchance you tweeted something ah-mazing, and I missed it, and thus you missed your chance to be immortalized here. Mea culpa! Talk to me at tonight’s SharePint–perhaps I’ll let you beat me in a plank-off.

  • @mikegil Best tweet of #sptechcon from my 20 y/o nephew, just lurking: “Everyone here looks like you.” Compliment? Jab? If so, to whom?
  • @BCJonesey: back of @cmcnulty2000 session = tweep-ville, glad I wore my glasses @janishall @mikegil #SPTechCon #Nerds
  • @DougHemminger Just heard @WonderLaura refer to a “G – U – I – D” instead of “Gooid”…Is “Gooid “a developer pronounciation? #SPTechCon
  • @lefteyes: “Everyone likes rainbows and ponies” #SPtechCon
  • @TiffanyWI: All the cool #SharePoint kids are at #sptechcon Continue reading SPTechCon’s Top Tweets, Vol. 2

SPTechCon’s Top Tweets, Vol. 1

While we aren’t rolling into the ‘Con until tomorrow morning, the party has definitely already gotten started. I know, right? Sounds impossible, and yet a quick search for #sptechcon on twitter says otherwise. Tweets have ranged from the informative recap to the feed-me-seymour to the cheerleader. Below, a few of my favorites:

  • @timferro Great #InfoPath session at #SPTechCon @cwheeler76 ! I now only dislike it rather than my previous outright loathing!
  • @Chomp1313 Loving #sptechcon but lack of chocolate may be a problem
  • @buckleyplanet @gvaro + Lady Gaga meat outfit = #SPTechCon lightning talks tonight at 5pm
  • @sitwalkstand Useful tool for explaining “virtual folders” and metadata in SP is Excel filter feature to create a SP view #sptechcon
  • @lefteyes: The base metaphor for document management is a filing cabinet. Why are we still using 1950 tech to organize info in 2011? #sptechcon Continue reading SPTechCon’s Top Tweets, Vol. 1

SPTechCon Boston: 10 Must-Do Extracurriculars

SPTechCon is looming, the SharePoint community is booming, and, here I’m zooming in on a few of the Hub’s not-to-be-missed activites. Because everyone needs a at least a little r&r between sessions. And because my hometown is a pretty swell city—it’s very walkable, aesthetically and gustatorially pleasing, and, yes, crammed with people who sound like extras from The Departed (you can usually identify them by their ever-present liter of Dunkin’ and their well-worn Sox sweatshirts). I’ve divided them by time of day, and kept most of them in or close to the Back Bay, but remember: for all its blessings, Boston is also a city cursed with subways that stop running at 1am, bars that close at 2am and sky-high cab fares.

Morning:

1)      The Banks of the River Charles

a.       Neighborhood(s): all over

b.      Why:  Runners (and walkers and city planners), welcome to paradise. Boston offers many fantastic runs, the most obvious, and picturesque place to run is along the Charles River, which separates Bostonians from Cantabridgians and offers a uninterrupted views of both cities’ skylines. You can hop on and off from almost anywhere, but, if you’re a breakfast sandwich afficianado, you should end at the Boston Common, and proceed to no. 2:

2)      Mike and Patty’s

a.       Neighborhood: Bay Village

b.      Why: This wee slice of a breakfast/luncheonette makes the city’s best sandwiches. This is according to more renowned palates than mine, but you can’t go wrong with the fried green tomato BLT, the bacon and egg fancy (fried egg, cheddar, avocado, caramelized onion), the grilled banana and nutella sandwich and the breakfast torta. Weekends, the line snakes up the cobblestoned street, but on a weekday, you should be fine. Continue reading SPTechCon Boston: 10 Must-Do Extracurriculars

Blogged