C# Sendkeys with formatted text - c#

So, I'm trying to send formatted text(RTF or HTML format) using SendKeys.Send, is this possible?
The only way that I found in order to do this: Set the text to clipboard and then paste it, but after doing some research I've found that this isn't a good practice and also I can't find a way to restore the clipboard after I paste the formatted text.

So I've solved this, when I was restoring the clipboard I didn't had any delays and because of that it wasn't working properly, now after I've added a small delay everything is working fine, in case someone have the same problem.

Related

Excel opening CSV with wrong encoding

This is partly a question for the Microsoft forums too, but I think there might be some coding involved.
We have a system built in C# .NET that generates CSV files. However, we have problems with special characters "æÆøØåÅ". The thing is, when I open the file in NotePad, everything is correct. But when I open the file in Excel, these characters are wrong. If I open in NotePad and save without actually doing any changes, it works in Excel. But I dont understand why? Is there some hidden information added to the file that can we adjusted in our C# code to make it correct in the first place?
There are other questions like this, but all answers I could find are workarounds for when you already have a wrong CSV file. In our case, we create this file, and the people we send the files too are usually not computer-people capable of changing encoding, etc.
Edit:
Here is the code we tried to use at the end, after generating our result CSV-string:
string result = "some;æøå;string";
byte[] bytes = System.Text.Encoding.GetEncoding(65001).GetBytes(result.ToString());
return System.Text.Encoding.GetEncoding(65001).GetString(bytes);

How to read highlighted text?

I made a windows app and i want that app to read the highlighted text but i am unable to solve this problem.
Can anyone suggest me how can it read highlighted text from anywhere. Example browser and notepad etc.
For simple strings I use
obj.SpeakAsync("Hello");
But How to read highlighted text?
I am so confused please tell me any method that solve this problem.

Creating an HTML document out of RichTextBox in WPF

I am having issues creating an html document out of a RichTextBox. I am able to get all of the text out of the RichTextBox. This issue is when I go to get images that I pasted in by using Windows Snipping tool don't show up in the document. Is there a way to do this?
Perhaps you could give us a non-working example where the error occurs in order to help you. Anyway, you could also check this and this out.
Hope I helped!

Convert a website to Html to Excel

I have the below as part of a web application(asp.net) is there any way to convert it to excel? The problem is printing it. Landscape is the desired format and persons in the organization are very novice so to improve usability i want to allow it to be in landscape. I tried activex and sendkeys commands. This works but not what i desire..
Please help....
Two ideas:
(1) Copy + paste. If there is too much noise then try (2).
(2) Copy the HTML into a text file, read the text file into a program, have the program parse the HTML in the way that you need it. From there you should be able to format it as needed or just flat out copy/paste it into Excel.
Are your pages table-driven (<table><tr>...) and not laid out with CSS? If so, this has been asked and answered before. Excel can consume tabular HTML like a champ.

ctrl-v image into richtextbox in sharepoint

I'm trying to ctrl-v an image into a RichTextBox in SharePoint using C#. So far, I've had no luck in successfully doing so. The image appears as a white space or as a broken image.
I know there is the option of using the clipboard or converting formats, but I'm not too sure how to do that (I've heard I need to convert clipboard image to a certain format before inserting it). Moreover, I want to check to see if anyone has tried to do something similar with success first.
Thanks.
Chris
This is not possible out of the box, you can however use RadEditor for sharepoint from telerik, it's free (the lite version) and allows for uploading of images while you are editing a page. Mind, you still need to upload the image first, then you can include it in the text using a url.
See this post for more info.

Categories