We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Excel placing numbers into cell, always formatted as text

As we place values from JSON to cells, we want some formulas to directly work with the values,

It complains about the Textformatting:
image.png (41.5 KB)

This is the tag; <<[sr1?.seriesMeasurements?.groundwaterLevel?.value / 100]>>

This tag also did not work; <<[sr1?.seriesMeasurements?.groundwaterLevel?.value / 100]:“0.00”>>

So I had to do some workaround, by placing it somewhere else first and try to copy he numeric value. But this is messy and eventually cant be done for all the fields.

image.png (65.8 KB)

Strangely, the DateTime is correctly formatted. with this tag:
<<[gws?.preSamplingMeasurements?.enrichmentFieldSampleMeasurements?.formattedStartTime]:“HH:mm”>>

Please fix this, when placing numbers, make it a number format directly

@TerraIndexService

Could you please share the following details:

  • API Version that you are using (e.g. 21.9, 22.2)
  • Sample code to generate report
  • Excel template and data source files

We are using version 22.2

Attached the json and template
Template_Groupdocs.zip (226.0 KB)

try
{
var dataSourceInfos = new List();
if (partialTemplates.HasValue)
{
var dataSource = new DataSourceInfo(partialTemplates.Value.Value, partialTemplates.Value.Key);
dataSourceInfos.Add(dataSource);
}

            AddDataSources(dataSourceDefinitions, dataSourceStreams, dataSourceInfos);

            FileFormat groupDocsFileFormat = ConvertFileFormat(outputFileFormat);

            using (var templateStream = new MemoryStream(template))
            {
                using (var outputStream = new MemoryStream())
                {
                    var assembler = new DocumentAssembler
                    {
                        Options = DocumentAssemblyOptions.AllowMissingMembers | DocumentAssemblyOptions.InlineErrorMessages | DocumentAssemblyOptions.UpdateFieldsAndFormulas
                    };

                    // todo: load by convention
                    assembler.KnownTypes.Add(typeof(StringExtensions));

                    assembler.AssembleDocument(
                        templateStream,
                        outputStream,
                        new LoadSaveOptions(groupDocsFileFormat),
                        dataSourceInfos.ToArray());
                    
                    output.Report = outputStream.ToArray();
                    return output;
                }
            }
        }
        finally
        {
            DisposeAllDataSourceStreams(dataSourceStreams);
        }
1 Like

@TerraIndexService

We are investigating this issue. Your investigation ticket ID is ASSEMBLYNET-224. You’ll be notified in case of any progress update.

Hi Atir, do you have any updates on this?
Our Excel reports can’t work with formulas now, what is annoying

@TerraIndexService

We are still investigating this ticket.