Question: I am using global variable in my `.cshtml` view as below-

```
@{
string canvasimage="";
}

```

Where I want to put some value in this using jquery-

```
<script>
    function GetData() {
        var image = $('#canvasoverdues canvas');
        var src = image[0].toDataURL("image/png");
        src = src.replace('data:image/png;base64,', '');
        @canvasimage=src;
    };
</script>

```

and then want to use this global variable in anchor tag as below-

```
<a href="/PDF/Certificate/?filename="+@canvasimage+" id="canvasbutton" >convert to image</a>

```

But I get syntax error in using this global variable in script. 

My question is how can we use this global variable and assign it a value.

If this is not possible kindly let me know how do I send value of function `GetData()` into parameter named `filename` in anchor?

Answer: 
You should read the file using something like that:

Read the file to a String usign Files.readAllbytes() and then split the content into a list of Strings: 

Then you should apply some java project like apache POI here is a example using excel:

<http://poi.apache.org/spreadsheet/how-to.html#sxssf>

Good luck!!
You can save the properties file as a csv file.
Just rename it from `[filename].properties` to `[filename].csv`

Then you can import the csv file in Excel by using the import function whitch can be found in the menu under `Data` -> `from text`.

After clicking on `from text` there should open a popup in which you can set the import options. 

In the first step inside the popupwindow select separated an go to the next step.

Here you can choose what symbol is the separator of the csv file.
Just write `=` into `Separator`->`other` and press on `finish`. 

You can also find a good documentation about how to import csv to excel here: <https://superuser.com/questions/407082/easiest-way-to-open-csv-with-commas-in-excel>