We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

What causes this error when using ApplyMarkers method?

Hi,

I have a template with various markers in it and AddVariables (both simple strings and datatables) to it via the CreateTemplateMarkersProcessor object but when I try and ApplyMarkers (with ReplaceBlank UnkwownVariableAction option set) I get the following error message:

System.ArgumentOutOfRangeException occurred
Message=Can't find property
Parameter name: strText
ParamName=strText
Source=Syncfusion.XlsIO.Base
StackTrace:
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.GetNextValue(Object value, String& strText)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.SetSimpleValue(Object value, String strText, IWorksheet sheet, IMigrantRange migrantRange, IList`1 arrMarkerCells, IList lstArguments, MarkerOptionsImpl options, RangeBuilder builder, UnknownVariableAction action)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.UnknownProperty(String strProperty, UnknownVariableAction action, String strText, IWorksheet sheet, IMigrantRange migrantRange, IList`1 arrMarkerCells, IList lstArguments, MarkerOptionsImpl options, RangeBuilder builder)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.SetDataTable(DataTable value, String strText, IWorksheet sheet, IMigrantRange migrantRange, IList`1 arrMarkerCells, IList lstArguments, MarkerOptionsImpl options, RangeBuilder builder, UnknownVariableAction action)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.SetUnknownVariable(Object value, String strText, IWorksheet sheet, IMigrantRange migrantRange, IList`1 arrMarkerCells, IList lstArguments, MarkerOptionsImpl options, RangeBuilder builder, UnknownVariableAction action)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.SetVariable(String strVariable, String strText, IWorksheet sheet, IMigrantRange migrantRange, IList`1 arrMarkerCells, IList lstArguments, MarkerOptionsImpl options, RangeBuilder builder, UnknownVariableAction action)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.ApplyMarker(IWorksheet sheet, IList`1 arrCells, Int32 i, IMigrantRange migrantRange, UnknownVariableAction action)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.ApplyMarkers(IWorksheet sheet, List`1 arrLabels, UnknownVariableAction action)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.ApplyMarkers(IWorkbook book, UnknownVariableAction action)
at Syncfusion.XlsIO.Implementation.TemplateMarkers.TemplateMarkersImpl.ApplyMarkers(UnknownVariableAction action)

What causes this error?




3 Replies

SR Sridhar Syncfusion Team January 27, 2011 06:51 AM UTC

Hi Steve,

Thank you very much for using Syncfusion.

As you have reported in your last update we hope the exception could cause because of importing the set of data from the template which has a named range within it. It would be great if you could able to update us a simplified issue reproducing sample ,so that we can able to sort out the actual cause of the issue and help you out for the same.

Please let us know if you need any clarifications.

Thanks,
Sridhar.




ST SteveTummey January 27, 2011 12:21 PM UTC

Dear Sridhar,

Thanks for the reply.

I've managed to figure out the cause of the error mentioned above.

If you have a set of Datatable.FieldName markers in the template but if the datatable you actually add to the template via the AddVariable method doesn't contain a field that has a marker specified for it in the template you get this error.

Steve





SR Sridhar Syncfusion Team January 28, 2011 01:39 PM UTC

Hi Steve,

Thanks for the update.

By default, the template markers in MSExcel accepts the fieldname with the method addvariable() when applying markers.The markers can't add to the excel if you did not specify the Fieldname of an datatable used.This is the basic functinality and we can't change the format to accept.

Please let us know if you need any clarifications.

Thanks,
Sridhar.






Loader.
Live Chat Icon For mobile
Up arrow icon