Get next sequential Number/Variable Excel C# - c#

Is there anyway to get the next sequential number or variable in excel if data is already entered in a certain column of excel. I have tried a couple things, but know I am taking a wrong approach. If anyone knows how to do this I would greatly appreciate it.
MLB028Z-MTRSPR-B-A
MLB028Z-MTRSPR-B-B
MLB028Z-MTRSPR-B-C
MLB028Z-MTRSPR-B-D
So on and So on

You could use Excel OLE automation to fire up an instance of Excel and use that to populate the next value and then read that out.
That said OLE automation is like any good movie, there is many a trap lying in wait for the hero in the story, and I would only ever do this if you had no other choice.
Thankfully you do: Solver Foundation or Baynes Algorithms (+ loops)

Related

Certificate Transparency Logs for C#

Currently working on a certificate transparency logs. My goal is to read each log just like what CertStream - (Open the fire hose button) did, my boss wants to create another one that is written in C#. Just a simple code to parse the logs can really help me. Not necessarily as fancy as CertStream does its stuff.
These are the following links/APIs that I've read:
(API's from Google or related)
https://ct.googleapis.com/pilot/ct/v1/get-sth
https://ct.googleapis.com/logs/argon2020/ct/v1/get-entries?start=20200201&end=20200205
https://www.rfc-editor.org/rfc/rfc6962
Valuable info:
https://certstream.calidog.io/
https://stackoverflow.com/questions/59772797/cant-parse-precertificate-from-certificate-transparency-log
For the code I started,
byte[] byte_LeafInput = Convert.FromBase64String(leaf_input);
byte[] byte_extradata = Convert.FromBase64String(extra_data);
string strLeafInput = Encoding.UTF8.GetString(byte_LeafInput);
string strExtraData = Encoding.UTF8.GetString(byte_extradata);
But it only shows some gibberish data with few readable words.
Any codes or libraries that can help me with that? Upon searching, I found so many codes written in different languages like Python, Go, etc., but based on what I understand in their code, they are also using libraries which is not available in NuGet. X509Certificate might be useful but I don't know how to use it in this case.
Any lead would really be appreciated. Thank you.
Upon searching for a long time. My boss advised me to get the logs and parse it through Python and save that in a text file or csv. After that, my program in C# can use all functions to analyze the information in the created text file. I guess using the current wheel is more efficient than creating one. :)

How to Access the Undo Stack in Excel from C# via Office Interop?

I'm building a C# app that needs to interact with an Excel spreadsheet via Office Interop. I'd like to gain access to the full Undo stack so I can make a series of changes to the worksheet and then roll them back one at a time if necessary. I see that the Word Document object in the Interop assemblies has UndoRecord and some other niceties, including an Undo function. For example, I can call Microsoft.Office.Interop.Word._Document.Undo() with a parameter to undo multiple actions. Excel's Undo stuff, on the other hand, looks much more limited. Sure, there's Microsoft.Office.Interop.Excel._Application.Undo(), but it goes only one action deep, and if called again performs a "Redo" instead of going deeper down the stack.
I've found code online where VBA developers coded their own Undo histories for Excel because that was the only way to get the desired functionality. I don't see anything like this for C#, though. Is there any way to mimic the way Word's Interop undo works in Excel?
Alas, what's true for Word isn't for Excel. Probably because so many more people write Word VBA :). See this John Walkenbach page for what is possible in Excel VBA (and interop). Here's part of his description:
Making the effects of your subroutines undoable isn't automatic. Your
subroutine will need to store the previous state so it can be restored
if the user choose the Edit Undo command. How you do this will vary,
depending on what the subroutine does. In extreme cases, you might
need to save an entire worksheet. If your subroutine modifies a range,
for example, you need only save the contents of that range.
EDIT:
There is the Application.Undo method, but it's very limited. Here's the description from Excel 2010 VBA help:
Application.Undo Method
Cancels the last user-interface action.
Remarks This method undoes only the last action taken by the user
before running the macro, and it must be the first line in the macro.
It cannot be used to undo Visual Basic commands.
In regards specifically to Interop, I'm sure there's nothing available that's not in VBA itself.

Two-way communication between Excel and my C# program

I want to have a two-way communication between Excel and my C# program. When some data changes in Excel, I need to know (in real time) what changed in Excel. In the other direction, based on some events, I want to update Excel worksheet (in real time). Eventually, my program will be deployed onto a Windows Server.
Can you please suggest what are the best ways to do this?
I understand that you want to follow all changes made in a workbook. For that you might need the Worksheet_Change event as described here. You will need to set the Target argument to the area (Range,Worksheet) you're supervising. You could be able to build a log with the changes that are made to the Target ranges. The second part of your question is pretty vague, what events are we talking about ? Worksheet_Change might be the answer again but more information is needed.

Excel 2010 equation editor access via C#(VSTO)/ VBA

I need to get access to Equation Editor that's built in Excel 2010. In Word2010 it's quite simple as it provides OMath interface to access it via C# or VBA. There's no such thing in Excel eventhough it's possible to insert equations this way. Has anyone solved this problem ?
I need to extract the equation from the eqution object in a text way (no metter if it's Latex, MATHML or any other language. It just has to be a single string)
Of course I can use MathType to do this (Actually I've alredy done this with MathType) but I don't want to force the User to buy MathType as Excel has built in feature that would do the trick.
Have you tried adding an OLE object first, as mentioned in this link?
http://www.techyv.com/questions/it-possible-equation-editor-vba-excel-2010
I don't have an enormous amount of experience with Excel's equation behaviour but it seems Excel doesn't use the OMath object. As far as I understand:
You can add a new Equation with:
ActiveSheet.OLEObjects.Add(ClassType:="Equation.3", Link:=False, DisplayAsIcon:=False)
And subsequently, you can access these objects using the OLEObjects collection:
ActiveSheet.OLEObjects.Item(1)

powerpoint record rehearsal timings

Does anyone know how to set powerpoint's record slideshow/rehearsal timings using c# or VB? Can it be done in the open xml files? Or what developer references am I overlooking? I want to be able to choose a different method for timing up a self running presentation.
Here's code to add a 2 1/2 second rehearsal Timing to Powerpoint
slide.SlideShowTransition.AdvanceTime =2.5f;
slide.SlideShowTransition.AdvanceOnTime = MsoTriState.msoTrue;
Took me forever to find this, so hoping it helps others
Happy Programming!
AdvanceTime is stores the duration of the whole slide the event trigger time is stored in tag.xml file as Timing the values are stored as a pipe delimiter values like '|34.0|34|3|5.4'

Categories

Resources