Quantcast
Channel: RESX Manager
Viewing all articles
Browse latest Browse all 252

Commented Unassigned: using ResXManager dlls [3048]

$
0
0
_Hello,

I am trying to use the dlls so I can take advantage of the export and import functionality. I built a console app. The solutions has referenced all the dll's that I assume would be needed.

using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using tomenglertde.ResXManager.Model;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Spreadsheet;
using tomenglertde.ResXManager.View;
using DocumentFormat.OpenXml.ExtendedProperties;
using Microsoft.Win32;
using EnvDTE;
using tomenglertde.ResXManager.VSIX;
using tomenglertde.ResXManager;
using System.Windows;

Export works fine:_

//Code below creates an excel in the same format as the tool itself
string solutionFolder = @"C:\project-test\ConsoleApplicationUploadtest";
ResourceManager x = new ResourceManager();
x.Load(solutionFolder);
ExcelExtensions.ExportExcel(x, @"C:\Users\sfarahba\Desktop\test\test0527(2).xlsx", null);


Import runs fine but does not actualy change any of the values that were edited in the excel document:

//the following code imports an excel ainto the resouce
string solutionFolder = @"C:\project-test\ConsoleApplicationUploadtest";
ResourceManager x = new ResourceManager();
x.Load(solutionFolder);
ExcelExtensions.ImportExcel(x, @"C:\Users\sfarahba\Desktop\test\test0527(2).xlsx");


</br></br>

What is wrong with my Import? Am I declaring and loading the resource manager object properly?
I have tried everything but importing does not work this way. I get no errors but any of the values that I change in the excel does not actually update the resx when I perform import?
Comments: ** Comment from web user: luclucas **

The class XlsxConverter should work (ExclConverter is the obsolete class for *.xls files). To store changes to the resource files you have to call solution.Save();

The following code worked in my example (with some additional Settings for the Export, but that is not the problem).

```
VSSolution solution = new VSSolution(@"E:\TestProject\TestProject\TestProject.sln");

//Export
XlsxConverter x = new XlsxConverter(solution);
x.AutoAdjustLayout = true;
x.ExportComments = false;
x.ExportDiff = false; // Export missing entries only
x.Export("E:\\Temp\\Test.xlsx");

//Import
x.Import("E:\\Temp\\Test.xlsx");

// Save changes
solution.Save();
```


Viewing all articles
Browse latest Browse all 252

Trending Articles