How to tell where (what cell(s)) an XmlMap is pointing to? - c#

I need to grab the ranges (row, column etc.) a particular XmlMap in an excel worksheet is pointing to programmatically via interop. Does anyone have any thoughts? I can not see any properties/methods/members of the XmlMap interface that provide this information.

I ended up solving this problem by dumping the XmlMap output to a file, using the .NET XML library to find all of the elements in the map and the using 'Worksheet.XmlDataQuery' to find to cell/range location of each element. Its dirty, but its the only way I could get this to work.

Related

C# easiest way of storing strings to external file

C#
TL;DR: I want the user to be able to input text, which is then written to an external file, which then can be called later based on position in the file. What's the easiest way and form to read and write a list of strings to?
Very amateur question, but I can't seem to find an easy anwer on the internet. If I'm missing something obvious, please redirect me. I am writing a very simple program in which the user can input a string which is then written (added) to an external file, from which later a string can be called based on the position in the file. I found things like JSON, Resource file, SQL DB... Problem is that due to my lack of programming experience I have no idea what's the best option to look into.
Example of what I want to achieve:
User inputs strings 'Dog', 'Cat', and 'Horse' into the textbox. Each of these strings are added to the external file. Lateron, the user calls the 2nd number on the list, to which the program returns 'Cat'.
Thanks!
If you already know the kind of data that will be saved I recommend using XML Serialization. This lets you save and read your file very easily. The linked example is from Microsoft and shows a dataset being serialized. If you want to save a generic list instead of a fixed object you might find this link helpful.
Alternatively, you could save data to your application configuration file (search online for "C# application configuration for PROJECT_TYPE" where the project type is winforms/mvc/class library etc..)

C# Get excel macros name

How to get list of macros names that's displayed in tab "Developer" by button "macros"? I found some solution (https://social.msdn.microsoft.com/Forums/vstudio/en-US/ef1de29a-81c7-424a-b7ab-f85286a1d8de/how-to-retrieve-a-list-of-macros-in-an-excel-workbook?forum=vsto), but it's work with button "Visual basic" in same tab. Maybe we can extract macros names from there?
"Maybe we can extract macros names from there?"
Obviously no, you can't.
And the answer in your link already said this "As far as I know, there is no a property which can be used to get the names of macros.".
So there is no built-in way to extract them.
The only way I can imagine is parsing all the code and looking for Function and Sub to collect their names. But this can be cumbersome.
Maybe studying the source code of the Rubberduck AddIn at GitHub can help. I know that such a parsing is implemented there (in C# aswell) as they need it to generate a list of functions/procedures too, so maybe this can help you getting an idea how to implement this.

Importing from CSV into LanguageText

Is there any way to import values from a CSV column and place them in the LanguageText database table using Umbraco's LocalizationService? Basically I have a bunch of button Dictionary items i.e. "submit_button", "bootstrap_button" etc.. but I want to have the translations for each i.e. "שלח" with each language, but I seem to have to do it manually, can anyone give me any suggestions?
Thanks in Advance
Have you seen this Umbraco package?
https://github.com/hfloyd/DictionaryDashboardForUmbraco
It looks as though it can help you import/export dictionary items, but via XML. If nothing else, maybe some of the source code can give you a starting point to use CSV instead?
https://github.com/hfloyd/DictionaryDashboardForUmbraco/blob/master/src/DictionaryDashboard/Usercontrols/import.ascx.cs

How to read custom column values from an mpp file using Aspose.Tasks

I'm working on a c# and MVC3 project where I am using Aspose.Tasks to extract data from an mpp file, everything is doing fine - except that I can't find a way on how to read the values of a custom column. By custom column I mean a column that is not listed on MS Project's column names (e.g. Insight, Cyclic, and so on).
I was wondering if anyone here has figure that out and share some thoughts with me? I was hoping Aspose.Tasks would allow me to get column values by column name or column index which would surely solve my problem, but I can't seem to find any way to do that from Aspose's generated properties when reading the mpp file.
Originally the Aspose.Tasks API was similar in some areas to MPXJ. That doesn't seem to be the case now in this particular area, but I'll give you an idea of how MPXJ handles this which may help you to locate the equivalent functionality in Aspose.Tasks.
MPXJ provides the Task.getFieldByAlias() method which will allow you to retrieve the field you are interested in using the user-visible custom column name rather than the standard MS Project name for the column.
There is also ProjectFile.getTaskFieldAliasMap() which will give you the mapping between the user-visible names, and the enumerations used to represent the custom column types.

display icon with respective file

Ok this is something new to me....
I have a gridview control which is displaying the files and directory names in one column.
Now i want to display the file icon of that particular file in the other column...
eg test.txt will have a different icon form image1.jpg and here.xsl
i have found two examples but don't kno if they will work or not....
http://www.codeproject.com/KB/custom-controls/AssociatedIconsImage.aspx
or
http://forums.asp.net/t/90921.aspx
how to incorporate this with my gridview..?
thanks
I found a source that should be useful for you (and with a simple google query btw.): Getting Associated Icons Using C#
.
As far as I know, there's no other way than using the shell32 library via interop, as used in the given example.
I'm not sure if there is a managed way to this... there very well could be, but the unmanaged way to get this would be to use PInvoke to call SHGetFileInfo. There is sample code on PInvoke.Net which should get you most of the way there.

Categories