Thread: CSV Table Importer MK
-
July 9th, 2019, 14:23 #1
CSV Table Importer MK
Now Available on the Fantasy Grounds Forge: https://forge.fantasygrounds.com/shop/items/34/view
This extension allows you to import the contents of a Comma Separated Values(CSV) file into a Formatted text control. Importing the CSV into a formatted text control will create it as a formatted table.
Note: This extension is based on the CSV Table Paster extension by lokiare which is available here: https://www.fantasygrounds.com/forum...Access-release Much thanks to him.
Usage:
Usage: Open the window where the text will be imported. In the formatted text field, add a line with "#table#" as the only text on the line. Click the Import CSV button below and select your CSV file.
If the table is not importing, try closing the record and reopening it, then Importing the CSV again.
Supported Rulesets: CoreRPG, 5E, 2E, PFRPG, PFRPG2, Savage worldsLast edited by mattekure; May 5th, 2022 at 21:34.
For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/FVgtecr
DMsGuild Conversions https://www.dmsguild.com/browse.php?...iate_id=712946
DMsGuild Extensions Support Threads: Syrinscape Sounds, 5e Coin Converter,Shops, ID All, Player NPC End Turn, CT Open on Turn, Unshare Image, 5e Modifier Buttons
Other Helpful Links: Custom Calendar Tutorial, Custom Calendar Creator, Linker, CSV Importer, Font Extensions, 5e Class, Background, Race, Feat interpreted strings, Extended Language Fonts
FG DM Video Series: https://www.youtube.com/playlist?lis...Y5zjaBmVgwR2cc
-
July 9th, 2019, 20:30 #2
Saint
- Join Date
- Apr 2007
- Location
- Mississippi, USA
- Posts
- 1,015
This extension uses code from my extension with permission from me to use it.
Support:
https://support.fantasygrounds.com/
Have a suggestion for a feature? Go here https://fgapp.idea.informer.com
-
July 10th, 2019, 04:30 #3
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
Adding a string option for the CSV Separator
Here's how you can do it:
In your onInit routine, place the following code:
Code:OptionsManager.registerOption2("GENPUNC", false, "option_header_game", "option_label_GENPUNC", "option_entry_stringer", { baselabel = "option_val_comma", baseval = ",", default = "," });
The false parameter tells the option manager it is an option that should be stored in the campaign database (true causes it to be stored in the campaign registry).
'option_header_game' tells the Options Manager to put the setting into the games settings area (see the strings\strings_utility.xml file for the constants you can use to control where the option appears)
'option_label_GENPUNC' tells the Options Manager to look for this string resource for the label you want assigned on the options manager. It looks like this:
Code:<string name="option_label_GENPUNC">Generators: Punctuation to separate items in a series</string>
Code:<windowclass name="option_entry_stringer"> <margins control="0,0,0,2" /> <script> local sOptionKey = nil; local sDefaultVal = ""; local enable_update = true; function setLabel(sLabel) label.setValue(sLabel); end function setReadOnly(bValue) stringer.setReadOnly(bValue); end function initialize(sKey, aCustom) sOptionKey = sKey; if sOptionKey then if aCustom then sDefaultVal = aCustom.baseval or ""; end enable_update = false; local sValue = OptionsManager.getOption(sOptionKey); stringer.setValue(sValue); enable_update = true; end end function onHover(bOnWindow) if bOnWindow then setFrame("rowshade"); else setFrame(nil); end end function onValueChanged() if enable_update and sOptionKey then local sValue = stringer.getValue(); OptionsManager.setOption(sOptionKey, sValue); end end </script>
What I have up there will make the default be a comma, and the 'option_val_comma' is a string resource you set up in your xml file like this:
Code:<string name="option_val_comma">,</string>
Code:local sSeparator=OptionsManager.getOption("GENPUNC");
-
July 10th, 2019, 11:54 #4
That was amazing Bidmaron, thanks. Excellent documentation
For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/FVgtecr
DMsGuild Conversions https://www.dmsguild.com/browse.php?...iate_id=712946
DMsGuild Extensions Support Threads: Syrinscape Sounds, 5e Coin Converter,Shops, ID All, Player NPC End Turn, CT Open on Turn, Unshare Image, 5e Modifier Buttons
Other Helpful Links: Custom Calendar Tutorial, Custom Calendar Creator, Linker, CSV Importer, Font Extensions, 5e Class, Background, Race, Feat interpreted strings, Extended Language Fonts
FG DM Video Series: https://www.youtube.com/playlist?lis...Y5zjaBmVgwR2cc
-
July 10th, 2019, 11:56 #5
Archangel
- Join Date
- Apr 2008
- Location
- Virginia Beach
- Posts
- 3,096
You are very welcome sir
-
August 4th, 2019, 20:42 #6
- Join Date
- Jun 2013
- Location
- Isanti, MN
- Posts
- 2,922
Bug: If there is whitespace between the comma and a following " then it ignores the quotes.
-
August 4th, 2019, 21:48 #7
This isnt actually a bug as this is not following the CSV standard. https://tools.ietf.org/html/rfc4180
CSV fields are separated by a comma and either begin with a double quote, or not. If a CSV field does not begin with a double quote, it cannot contain quote characters within it. In your example, the field is beginning with a space, and so the entire field should not contain any quote characters. If a CSV field does begin with a double quote, it can contain a quote symbol by escaping it with another double quote. For example. value1,"value2""stillvalue2",value3 where the middle term evaluates to value2"stillvalue2For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/FVgtecr
DMsGuild Conversions https://www.dmsguild.com/browse.php?...iate_id=712946
DMsGuild Extensions Support Threads: Syrinscape Sounds, 5e Coin Converter,Shops, ID All, Player NPC End Turn, CT Open on Turn, Unshare Image, 5e Modifier Buttons
Other Helpful Links: Custom Calendar Tutorial, Custom Calendar Creator, Linker, CSV Importer, Font Extensions, 5e Class, Background, Race, Feat interpreted strings, Extended Language Fonts
FG DM Video Series: https://www.youtube.com/playlist?lis...Y5zjaBmVgwR2cc
-
August 5th, 2019, 00:15 #8
- Join Date
- Jun 2013
- Location
- Isanti, MN
- Posts
- 2,922
You seem to have skipped the part that says:
While there are various specifications and implementations for the CSV format (for ex. [4], [5], [6] and [7]), there is no formal specification in existence, which allows for a wide variety of interpretations of CSV files. This section documents the format that seems to be followed by most implementations:
-
August 5th, 2019, 00:41 #9
Well, I guess one way to think of it is if the author of an extension wants it to work one way and its working that way, then it's working correctly.
Of course someone can always ask for an extension to be coded differently, but that's different than saying it not working correctly.
Problems? See; How to Report Issues, Bugs & Problems
On Licensing & Distributing Community Content
Community Contributions: Gemstones, 5E Quick Ref Decal, Adventure Module Creation, Dungeon Trinkets, Balance Disturbed, Dungeon Room Descriptions
Note, I am not a SmiteWorks employee or representative, I'm just a user like you.
-
August 5th, 2019, 01:00 #10For support with any of my extensions, visit my #mattekure-stuff channel on Rob2e's discord https://discord.gg/FVgtecr
DMsGuild Conversions https://www.dmsguild.com/browse.php?...iate_id=712946
DMsGuild Extensions Support Threads: Syrinscape Sounds, 5e Coin Converter,Shops, ID All, Player NPC End Turn, CT Open on Turn, Unshare Image, 5e Modifier Buttons
Other Helpful Links: Custom Calendar Tutorial, Custom Calendar Creator, Linker, CSV Importer, Font Extensions, 5e Class, Background, Race, Feat interpreted strings, Extended Language Fonts
FG DM Video Series: https://www.youtube.com/playlist?lis...Y5zjaBmVgwR2cc
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks