MY users want to download data into a spreadsheet, modify and then upload to save it. I have written a feature to download table into a tab separated file and upload the modified file. Now they want to review it before clicking "save". Wondering if there is any easy way to highlight modified cells.
PS: yes. some refuse to use any other tool. They love their spreadsheets.
Add an additional column checksum that is the hash of all the values retrieved from database and before saving re calculate the hash and highlight the cells that are modified.
If I understand the question, you want changed values to be denoted with a color or some equivalent identifier, you can do this with a simple macro in Excel:
Right click the tab you want to include the macro on and select "View Code", then type the following VBA:
Private Sub WorkSheet_Change(ByVal Target as Range)
Target.Interior.ColorIndex = 6
End Sub
This will make the background change for any modified cell to bright yellow.
You will need to modify the "download excel" function to supply a .xlsm file from your site and use a templated file on the server (look into EEPlus for serving up Excel files from .NET - supports templating) that contains the macro for this to work. If that is not possible, you could go the harder route and develop a custom Excel Add-In that tracks changes, but this would need to be deployed to each users workstation / Excel install..
Related
I want to get text from table in PDF file?
I cannot get cell in table. I was try to run example of Leadtools but it cannot auto detect cell.
https://www.leadtools.com/help/leadtools/v20/dh/fo/iocrtablezonemanager.html
Can you give me advice? Thanks all
In tables similar to the image you posted, you should be able to find the cells using the IOcrPage.TableZoneManager.AutoDetectCells() method. This method is used in the OcrMultiEngineDemo project that’s shipped with the current version of LEADTOOLS.
Here’s how you can test it:
Run the OCR Multi-Engine Demo.
Select the OmniPage OCR Engine
Open the image or PDF file that contains the table.
Draw a zone around the table.
Choose “Update Zones…” from the OCR->Zones menu.
In the “Update Zones” dialog, click “Detect Cells” as shown in attached image.
If this doesn’t give you the result you’re expecting, send the actual files you’re testing with to support#leadtools.com and explain how you tested exactly.
I have to replace a broken SSIS package that basically just combines the data from a number of different Excel files, and creates a single master file. My C# desktop application is putting all the data into the Excel file correctly, but the one problem is that the original file, which was of type .xls, has some kind of hidden formatting on the cells.
When you just view the data in the cells, it looks normal, but when you click on a cell and view it in the edit box, there is a tick mark (it looks like this ') in front of the data. Editing it out does nothing, it just reappears.
I am guessing it is a "cheater" way to force the data to be of type character, since Excel is such a stinker about turning text which is made up of only numbers into a cell of type number, even if you write it as a string.
I wish we could do without it, but when we try to use a file without that formatting, it blows up the application. And I do not have the time or budget to rewrite the application.
How can I duplicate this "tick" mark in the files which I am writing? Currently I'm using EPPlus for writing, but I can also use Microsoft.Office.Interop.Excel.
If this is too difficult, I would also be open to someone telling me how to manually edit the file after I have created it programatically, and just add the cell formatting to the data.
I am writing a C# app where I need to paste/link tables/ranges from existing Excel documents.
Functionality that I am looking for is this:
user can select a range of cells in an open Excel doc and do a Copy
user switches to my C# app and does a past-link ... my app shows the table from Excel.
user can edit the source Excel doc - this does not automatically get reflected in the C# app. But I want to provide a Refresh button that when clicked will update the C# app based on the latest data from the linked Excel sheet.
I have figured out how to do a basic copy/paste. I cannot figure out how to do this paste-link. Please note I do not want to ask user in my C# app for any cell ranges..I simply want to do paste-link of what is already in the clipboard...
Any ideas if this can be done...it is all Microsoft so I would be surprised if it can't be.. but I am a C# novice.
Thanks for all input.
I figured it out. Here are the steps.
User copies a range in Excel sheet. It goes to Clipboard in a number
of formats but CSV and ObjectLink formats are of particular interest.
In C# app, trigger a Paste-Link function (this is any button).
Retrieve data from Clipboard using ObjectLink format. This comes out as text which contains:
Excel version identifier
Path to the excel file
The sheet name and the selected range in R1C1 notation
Save the ObjectLink data in your C# app, we will use it later as part of refresh
Retrieve the data from clipboard using CSV format. Parse it out and present in C# app. I converted it to HTML since this is what I am building
Modify the original source excel file - change something in the cells that were part of the original range - save the file.
Go back to C# app, trigger Refresh functionality (this is any button). IN your code do the following:
Using ObjectLink data saved in step 2, open the Excel sheet in the background using Excel Interop API tools. Select the sheet and range. Copy the range programmatically to clipboard.
invoke the same copy from clipboard as used in the last step of 2. Basically get the updated Excel data in CSV format from clipboard and replace the original representation you built during step 1.
This works like a charm although the COM part of opening an excel doc from C# is a bit slow I have to admit.
I have not found any references to this procedure on the net...works for me like a charm.
Cheers.
I have a set of Excel spreadsheets with multiple tabs which contains each one table that I need to export as pictures in an automated process (I have dozens of such files to process).
While I could "manually" select the table, copy and paste them as image in another software, I need to industrialize this process to save time.
What would be the best approach using .Net or any builtin Excel feature?
Thanks
Check this question.
Programmatically (C#) convert Excel to an image
It looks like they're doing what you need?
Think I would use a small C# apop to do it - that assumes that you have a one off task and don't want to mess about with Excel templates or global excel macros and opening each spreadsheets etc.
I would do it like this:
dump all my excel docs in a single folder.
open up each doc in the folder in C# app
iterate each tab
If data capture data for all used ranges (from A1 to the whatever the bottom right cell is) - for any embedded charts pull them off as well
If chart pull it off
dump each to the folder as an image prefixed with the excel doc name and some iterative suffix like _chat01 _data01
How to rwead it ina and convert to image? See here => http://csharp.net-informations.com/excel/csharp-excel-chart-picturebox.htm
Copy all desired cells
Open MS-Paint
Paste
Save as PNG.
Good Morning,
I have a C# agent which runs periodically and updates certain values in a particularly important spreadsheet, the reason that this spreadsheet is updated is that periodically someone will manually go into this .xls file and print screen the worksheets and paste them in to a Powerpoint presentation template as images.
These 'images' aren't charts, nor tables, simply ranges of cells that are coloured etc in the spreadsheet - and what I'm looking to do is basically automate this by customising my agent so that everytime it updates the spreadsheet, it 'print screens' a certain range that I specify and copies it as an image into the .ppt file.
I appreciate this question lacks a code example, and I'm not expecting someone to 'do it for me', any advice or pointers on how I might accomplish this would be much appreciated.
Also VSTO is not an option unfortunately (work environment).
Many Thanks
You may not have the ability to control how other people create their PowerPoint slides, but if they want a specific range of cells to update to match what the excel sheet is currently, they can Ctrl-C the section then Paste Special.
I know your question asked about automating a print screen capture of the cell range, but would this work for you? Or must there be no possibility of an accidental update, or some reason it must be an image?
The linked section will automatically update if the file is open and if it isn't it will ask if you want to update the links on opening the PowerPoint. Or right-click on the object in the slide and update link.
I've been doing it too reccently.
It might give you an idea.
Put an Alternative.Text to your shape in PowerPoint, it might help you place your new image in the correct place.
C# Paste HTML to Excel or PowerPoint
Showing HTML in PowerPoint