Edit a premade macro-enabled excel document from AngularJS webapp - angularjs

I've got quite the issue that I can't seem to figure out how to do cleanly after hours of scouring the internet, hoping you all could help me out.
We have an AngularJS web-app that is used to create an object in a database according a large set of variables. After the object is put into the database, we want to put some of the fields into a macro-enabled excel doc containing some necessary VBA macros that then downloads to the user's computer.
From what I've found, Angular can output the data to a new excel doc, but we need to have the data put into the pre-existing excel document. The closest tool I've found is SheetJS from a different StackOverflow question/answer, but that answer doesn't actually implement the functionality to edit the current excel, only write to a new excel document.
Any and all suggestions on fixing my problem are appreciated!

I may have found an answer, but it's not quite available yet. I left an issue on the SheetJS GitHub page which got answered today. Sounds like macro persistence functionality is being added into the release this upcoming Friday. From there, add bookVBA:true to the options of your readFile call like XLSX.readFile("filename", {bookVBA:true, /* .. other options */});, and then on your writeFile call you add the option of bookType:"xlsm".
This is of course speculatory, as the change isn't live yet. I'll make sure to update this answer at that time.
EDIT/UPDATE: SheetJS now works in copying over macros to a new workbook, but there's currently a bug. If you have any code in the ThisWorkbook object to do anything on startup, sheet changes, etc., they won't work after writing back out, as it creates a new ThisWorkbook1 object. I've already opened an issue on it, but that should be fixed relatively quickly.

Related

Using Google Sheets to create a .xslx file from sql data

I am trying to create a .xlsx file with data I retrieve from mysql to a node.js server that serves an angularjs project, but after hours of trying to find something via npm or google I almost gave up!
The two main problems I have are:
My data is in hebrew (i.e. rtl styling + different characters).
The Excel file that I export needs to be styled in a specific way, and it is a pain trying to style an excel file grammatically.
And then I had an idea!
What if I could create a google sheet doc in my google drive as a template including the styling, and then when the user clicks to create a new doc, I would just duplicate this template, and change the values to the new data.
But just trying to understand the google api is a headache on its on, apparently, there are 3! different api's: Drive, Sheets and auth.
So my question is as follows.
Is my idea valid? does anyone think it could work?
Where would I start, is there some guide or npm that would help?
Please don't comment to look in the docs, I am having a hard time to understand where to start from there.
I would suggest creating the template file locally instead of opting to google spreads.
There is a decent module I used sometime back, which does styling pretty well, Its called exceljs.
Though there is always the xlsx module, Which is very powerful but difficult to use
Also if you end up using google spreadsheets, I would suggest giving node-google-spreadsheet module a look

VS 2013 Express - VB Update Database

I've looked all over and can't find an answer to my question. I'm trying to do the simplest database I can. I want to be able to add/edit/delete items and have it save them to the database, so they're in there the next time I open it.
I'm currently using VS 2013 Express and have the 2012 express still installed. was going through the MSDN tutorials and even tried the Northwind Database, but it said I had to upgrade it, but that it wouldn't allow me to. So now I'm stuck.
Currently, I've created a database, then a new project. I connected the new project to the database and drag-n-dropped one of the tables onto the form in gridview. In the interest of saving space, I won't go into a lot of detail. I basically followed the msdn tutorial on creating two tables called Customers and Orders, with a few variables and 3 entries a piece. There is a primary key in customers and a foreign key in orders.
I used the code MSDN provided, that was similar to what was already in the save buttons auto-generated code, except in a try/catch code. What I have so far is:
`Private Sub CustomersBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles CustomersBindingNavigatorSaveItem.Click
' Me.Validate()
' Me.CustomersBindingSource.EndEdit()
'Me.TableAdapterManager.UpdateAll(Me.SampleDatabaseDataSet)
Try
Me.Validate()
Me.CustomersBindingSource.EndEdit()
Me.CustomersTableAdapter.Update(Me.SampleDatabaseDataSet.Customers)
MsgBox("Update successful")
Catch ex As Exception
MsgBox("Update failed")
End Try
End Sub`
I apologize for the code not all being in the block, I couldn't get it to work properly. So, from what I can determine, it looks like this code updates the dataset and not the database. Is that true? If so, how do I update the database? When I run the program and add a row, I can click save and it returns a message box, saying it ran successfully. However, I can't rerun the program and have it display, much less shut the VS Express down and bring it back up to have it show the changes. Can anyone please tell me what I'm doing wrong here? Thanks.
Okay, I think I've found the answer to this question. It appears that what's happening is that there are two versions of the database. One version is stored in the root of the project folder, the other is stored in the bin/debug folder.
Apparently, for whatever reason, when you run your program to test your code it pulls from the root database. Any changes you make and save are copied to the one in bin/debug. I assume this is so that you can have stock information in your database and not have it altered by code that may or may not work the way you want. I understand that, but I think there is just as much reason to want it to save changes. I wish there were an option to make it that way and if anyone knows how, please share that.
I've spent a couple of years playing with databases, on and off, thinking I was doing something wrong, when in reality it's just the way VS was handling it. You can do one of two things to test if this is your issue. One is that you can go into the bin/debug and copy the .mdf and the .ldf, and paste them into the root folder, overwriting the two there. I'm not sure what the .ldf does, but it wouldn't run without it. Then when you go to runtime, your changes will be reflected. Another option is build your project and run the .exe in your bin/debug folder. It will run the program and any changes you make will stick, but again, only in the bin/debug version. I assume that a published project will save to the root directory.
I found the article that led to this breakthrough here: http://visualstudiomagazine.com/blogs/tool-tracker/2012/05/dealing-with-local-databases-or-why-your-updates-dont-stick.aspx

Export content from an ecommerce site without using the Backend

I have a site that I'm looking to transfer to Volusion. Importing tabled content into Volusion's a breeze, it's getting it tabled that's an issue. The old site has no real ability to export, nor do I know how to get at it's database. I'm thinking there must be some sort of script I can write to take the content from the frontend and download it in some sort of list that I can put into a CSV, and put into Volusion.
www.twincitygreetings.com
Any suggestions? I'm hoping to get in the image directory as well and download all them for upload to the new site.
You are going to need at the very least a file with product code, product name, weight and price.
Looking at the URL you provided it doesn't appear that the products their follow any type of orderly structure where you can target the images folder or products based on a known piece of information like a products code. Unless the back-end has some type of product export function you may have no choice but to recreate it from scratch.
I don't know if you solved this yet or not, but I would suggest scraping the data providing you have the information on the old site currently. This can be done easily using vbscript and excel, or if you aren't very savvy at coding you could look at a piece of software called mozenda. There are a whole variety of methods that can be used to scrape data, all of them pretty easy to learn with a bit of research. Basically you write a script that will crawl your dom and extract the data (to xml works best in my experience)
Hope this helps.

Lazreport - how to export to excel?

I created a report using LazReport (freepascal). I need to get this into Excel.
I tried saving the resulting report file (.frp) but I can't seem to find any app that opens it.
Then I thought it would be good to get this into Excel. But I can't seem to find any doc or instructions on how to do this. Has anyone found a solution to this and if so please share the answer here. If I have one simple example or steps that would suffice.
Thanks!
add frCSVExport in your form and when you show report click save and choice CSV format to save

FileStore step by step example with 4.2.1

I am wanting to upload a csv file, validate it, and then upload into an existing model. However, I am using ATK4.2.1 and finding that either the example code that have googled are either missing some steps or not relevant in version 4.2.1.
To this end, for my first step I have tried mixing and matching code in attempt to get a fileStore up and running with no working results thus far.
Is there a step by step tutorial/guide that anyone can point me to. The reference on the agiletoolkit.org site does not have any examples for the atk4-addons; that I can find. It seems that it is more involved than just adding an object to the page.
Grateful for any assistance.
You can find some installation instructions here:
http://agiletoolkit.org/doc/filestore
Import this SQL into your database atk4-addons/misc/docs/dbupdates/filestore-001.sql
Create a new page, page_fileadmin extends filestore/Page_FileAdmin
Create directory 'upload' and make it writable.
In your model instead of addField use $this->add('filestore/File');
If you need images, use filestore/Image instead.
Please join https://groups.google.com/forum/?fromgroups#!forum/agile-toolkit-devel for updates on new documentation.

Resources