Developer forum

Forum » Dynamicweb 10 » Dynamicweb.DataIntegration.Providers.ExcelProvider.ExcelReader is now Internal - Alternatives

Dynamicweb.DataIntegration.Providers.ExcelProvider.ExcelReader is now Internal - Alternatives

Pedro Meias
Reply

Hi,

We do have a feature for SwiftRizzo that uses 

Dynamicweb.DataIntegration.Providers.ExcelProvider.ExcelReader

After upgrading to 10.17.x, we now find that the class is internal and we cannot access the constructor anymore in our dll.

Here is our method for reference.

public static string GetJsonFromFile(string filePath)
{
    var json = new Dictionary<string, dynamic>();
    //Can't access ExcelReader after 10.17.x
    var excelFile = new Dynamicweb.DataIntegration.Providers.ExcelProvider.ExcelReader(filePath);

    if (excelFile.ExcelSet != null && excelFile.ExcelSet.Tables.Count > 0)
    {
       for (var tableIndex = 0; tableIndex < excelFile.ExcelSet.Tables.Count; tableIndex++)
       {
          var tableName = excelFile.ExcelSet.Tables[tableIndex].TableName;
          if (json.ContainsKey(tableName))
          {
             continue;
          }

          var tableJson = new List<Dictionary<string, dynamic>>();

          for (var rowIndex = 0; rowIndex < excelFile.ExcelSet.Tables[tableIndex].Rows.Count; rowIndex++)
          {
             var rowJson = new Dictionary<string, dynamic>();

             for (var columnIndex = 0; columnIndex < excelFile.ExcelSet.Tables[tableIndex].Columns.Count; columnIndex++)
             {
                var columnName = excelFile.ExcelSet.Tables[tableIndex].Columns[columnIndex].ColumnName;
                if (rowJson.ContainsKey(columnName))
                {
                   continue;
                }

                rowJson.Add(columnName, excelFile.ExcelSet.Tables[tableIndex].Rows[rowIndex].ItemArray[columnIndex]);
             }

             tableJson.Add(rowJson);
          }

          json.Add(tableName, tableJson);
       }
    }

          return Newtonsoft.Json.JsonConvert.SerializeObject(json);
      }

Are there any alternatives available since the class is now internal?

Thank you


Replies

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Yes, the provider moved from a seperate project/package to be part of the actual distribution.

Now the reader is internal as it is a commercial license and we cannot expose it through our API.

Is this the excel to order feature - or a step on the way? We could consider add your method or similar to the API instead.

 
Pedro Meias
Reply

Hi Nicolai,

This was initially for QuickOrder. We do use it in a couple a custom features for projects. Bulk Orders for example.

In this particular case, it is allowing the user to Update multiple product prices by uploading an excel file.

 
Nicolai Pedersen Dynamicweb Employee
Nicolai Pedersen
Reply

Hi Pedro

Bugged this as 25707

On its wat through

 
Pedro Meias
Reply

Hi Nicolai,

Thank you for your help.

 
Pedro Meias
Reply

Hi Nicolai,

We have been following the bug and It's already available for R1. Thank you for the quick help.

Would it be possible to move it to R2 ?

Our site is in R2 and we are trying to wrap up to move to Production.

Thank you.

 
Morten Buhl Dynamicweb Employee
Morten Buhl
Reply

Hi Pedro

The fix is in 10.18 which will roll to R2 tomorrow (Wednesday Oct 1st)

/Morten

 
Pedro Meias
Reply

Hi Morten,

Thank you.

 

You must be logged in to post in the forum