Link to home
Start Free TrialLog in
Avatar of nigelboot
nigelbootFlag for United States of America

asked on

"Error detected by export DLL" When exporting a report to pdf and a text field contains the tab character

I have an Invoice report that I have written that works in Crystal Reports .Net 2003.

This report is being bound using an xml dataset in the designer which is generated from the dataset returned by an SQL Server Stored Procedure.

There is a field in the report called InvoiceNarrative which is a CanGrow=True text box. It's basically a free text box that contains the narrative for an invoice request.

Whenever that field contains the tab character (as would occur if someone tried to indent some text items on an invoice narrative) the report gives me this error:
Message:

Error in File c:\inetpub\wwwroot\CrystalReports\\Invoice\CR_InvoiceRequests.rpt:
Error detected by export DLL:

Stack Trace

   at .~(String L, EngineExceptionErrorID M)
   at .y(Int16 D, Int32 E)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
   at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export()
   at CrystalDecisions.CrystalReports.Engine.ReportDocument.Export()
...

The report always works fine when there are now special characters (like the tab character) in the narrative field, but the moment one of the invoices has a tab character in the narrative i get this error.

I think it might be a text encoding issue, but have no idea how to get arround it. Any suggestions?
Avatar of Mike McCracken
Mike McCracken

Does the report work properly from the Crystal designer when the data includes a TAB character?

If so how is the XML dataset generated?  It is obviously changing the TAB character.

mlmcc
Avatar of nigelboot

ASKER

Firstly,

How do I test it in the Crystal Designer? I thought in Crystal Reports for VS.Net you could only use the designer to design the reports (not actually demo/debug them).

Secondly. The data set is not xml. The schema for the data set is xml. We generate the data set, get the xml schema from it and use that as the database for the crystal report when designing it. When the report is actually run we simply execure the dataset, this is done by calling an sql server stored procedure, and then add the DataTable as a datasource for the report.
I don't have .Net so if there isn't a preview mode then you can't use the Crystal designer.

I think you should use the stored procedure to build the report against rathe rthan the xml structure.  I'll bet there is a minor difference in the way strings are handled.

mlmcc

The problem is this.

The report is late bound. Basically I want to design the report against the xml schema of the storedprocedure because I want to be able to bind the report to the data at a later time, from the reporting service.

Anyhow I've generated the xml from the output of the storedprocedure, so can't see how there would be a suttle difference.

As there anyone here who could try to replicae this issue for me?

Keep in mind that I don't believe it's just the tab character. I think it might be a utf/ascii issue in the crystal reports engine, so other extended characters (like ms word's smart quotes) might cause the same issue.
What format are you exporting to?  Can you see if it works with other formats?  I ask because I found similar threads and this has been one of the troubleshooting tasks.  
Exporting as pdf causes the problem.

I've tried using the crystal reports web viewer control, and that seems to work. I've also tried exporting to formatted excel and richt text format and they both work.

It just seems to be when trying to export to pdf format.

I'd really appreciate being pointed to those similar threads. I have been unable to find any of them.

This sounds a tad similar...
https://www.experts-exchange.com/questions/21271466/Error-exporting-to-pdf-in-vb-net-net-win-app.html?query=Error+detected+by+export+DLL&clearTAFilter=true

Maybe not so helpful, but worth a shot.
https://www.experts-exchange.com/questions/20940347/Export-to-PDF-fails-using-ASP-NET.html?query=Error+detected+by+export+DLL&topics=40

The other issue I found was exclusive to using cross-tab spreadsheets, so it probably doesn't apply - but it was a documented issue with Crystal.

Thanks for posting those two links.

I had actually come across them before posting here. The reason I posted here though is this:

The first link seems to answer an issue where the user was completely unable to export to pdf. I can export to pdf if the report data doesn't have any tab characters in the narrative field of any rows of the data. Also I don't have the directory c:\program files\crystal decisions\ since I installed the crystal reports for .net 2003.

The second link is just code that shows you how to make a dynamic export to any format reporting page in asp.net. My system already does that anyhow using much the same boiler plate code. Again though, this issues seems to be about someone not able to  get the export as pdf to work at all.

i can get it to work, it just fails whenever any row in the returned result set contains a narrative field with the tab character in it.
OK.  I am unfamiliar with your use of XML in this situation so I don't think I can provide any help there.  Sorry.  Have you tried accessing this same data directly from a SQL view to try and weed out any XML schema issues?
Running the stored procedure on it's own returns a regular dataset.

The problem seems to be stemming from the varchar(1000) field that contains the tab character in it. I'm wondering if making it an nvarchar(1000) will make a difference? Though the xml schema for this field is mearly listed as:


<xs:element name="DS_InvoiceRequests" msdata:IsDataSet="true">
            <xs:complexType>
                  <xs:choice maxOccurs="unbounded">
                        <xs:element name="ccms_Report_InvoiceRequests">
                              <xs:complexType>
                                    <xs:sequence>
                                          <xs:element name="Title" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="CCYLocalCode" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="LocalisedFeesExTax" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="LocalisedTaxableExpenseExTax" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="LocalisedNonTaxableExpense" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="LocalisedAmountTaxAmount" msdata:ReadOnly="true" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="BUID" msdata:ReadOnly="true" msdata:AutoIncrement="true" type="xs:int" />
                                          <xs:element name="BUCode" type="xs:string" />
                                          <xs:element name="BUName" type="xs:string" minOccurs="0" />
                                          <xs:element name="BUCountry" type="xs:string" minOccurs="0" />
                                          <xs:element name="ClientManager" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="RequestedBy" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="TaxDescription" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactAddress1" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactAddress2" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactAddressCity" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactAddressState" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactAddressPostcode" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactAddressCountry" msdata:ReadOnly="true" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactPhone1" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactPhone2" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactMobile" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactFax" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactEmail1" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactEmail2" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceContactPosition" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvClientPONumber" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvDate" type="xs:dateTime" minOccurs="0" />
                                          <xs:element name="InvFor" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvTypeDescription" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvNarrative" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvExpNarrative" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvFeesExTax" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="InvTaxExpnsExTax" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="InvNoTaxExpns" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="InvTotalExTax" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="InvTaxAmount" type="xs:decimal" minOccurs="0" />
                                          <xs:element name="InvInstruct" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvProcessed" type="xs:boolean" minOccurs="0" />
                                          <xs:element name="ClientOrgName" type="xs:string" minOccurs="0" />
                                          <xs:element name="PerName00" type="xs:string" minOccurs="0" />
                                          <xs:element name="CCYCode" type="xs:string" minOccurs="0" />
                                          <xs:element name="InvoiceNumber" type="xs:string" minOccurs="0" />
                                          <xs:element name="ProgramName" type="xs:string" minOccurs="0" />
                                          <xs:element name="ProductTypeDescription" type="xs:string" minOccurs="0" />
                                          <xs:element name="PaymentMethod" type="xs:string" minOccurs="0" />
                                          <xs:element name="IsExternalIPContent" type="xs:int" minOccurs="0" />
                                    </xs:sequence>
                              </xs:complexType>
                        </xs:element>
                  </xs:choice>
            </xs:complexType>
      </xs:element>


It's the "InvNarrative" element that contains the text with the tab character in it

This talks about xs:string, and passes through tab char unchanged... suggested using xs:normalizedString
http://xformsinstitute.com/essentials/browse/re42.php

some more info on handling white space in XML (reccommends :against: using xs:normalizedString ...but talks about using xs:token....
http://lists.xml.org/archives/xml-dev/200309/msg00434.html
 
  - xs:string: preserves [whitespace]
  - xs:normalizedString: replaces
  - xs:token: collapses

thanks for those tips. reading up on them now.

It's important to note that that schema was generated automatically by using the DataSet.WriteSchema(), so that .Net decided what the type of that field should be.
Out of curiosity, why should whether or not the tab characters get passwed through cause a problem.

At the end of the day doesn't it inidcate that Crystal Reports is not being able to marshal the tab character into it's field? Is this  in fact a real limitation of Crystal Reports?

btw, I tried replacing all the strings with normalizedStrings, and then rebound to the new dataset (In Vs.net this is the "Verify Database" option). Still geting the error.
ASKER CERTIFIED SOLUTION
Avatar of janmarini
janmarini

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Do a search on PDF in the readme file, 2 of the 3 items found sound pretty interesting  - it *might* apply to your situation...
thought i had already applied said service pack, but may not have. applying again now
well there you have it. I had previously applied this service pack, but that was on a different test machine. Applying the service pack fixed the problem. Thanks for your help and patience janmarini.
I am so glad it worked out!