paste

Paste from Excel into C# app, retaining full precision

▼魔方 西西 提交于 2019-12-01 04:28:50
I have data in an Excel spreadsheet with values like this: 0.69491375 0.31220394 The cells are formatted as Percentage, and set to display two decimal places. So they appear in Excel as: 69.49% 31.22% I have a C# program that parses this data off the Clipboard . var dataObj = Clipboard.GetDataObject(); var format = DataFormats.CommaSeparatedValue; if (dataObj != null && dataObj.GetDataPresent(format)) { var csvData = dataObj.GetData(format); // do something } The problem is that csvData contains the display values from Excel, i.e. '69.49%' and '31.22%'. It does not contain the full precision

How can you intercept pasting into a NSTextView to remove unsupported formatting?

拜拜、爱过 提交于 2019-12-01 04:03:29
I'm trying to create a simple NSTextView-based window for simple WYSIWYG editing. However, I only want to allow certain types of formatting (e.g. Bold, Italic, Underline and a single heading type but no colors or different fonts.) The issue is if I simply use NSTextView, someone can create or copy formatted text in another program, then simply paste it into that view and all that formatting goes with it, allowing things I'm not allowing, such as different fonts, colors, etc. At best, I want to automatically strip out any formatting that my application doesn't support. At worst, I want to

How to paste a transparent image from the clipboard in a C# winforms app?

纵然是瞬间 提交于 2019-12-01 03:46:03
Note: This question is about pasting from the clipboard, not copying to the clipboard. There are several posts about copying to the clipboard, but couldn't find one that addresses this question. How can I paste an image with transparency, for example this one , into a winforms app and retain transparency? I have tried using System.Windows.Forms.GetImage() , but that produces a bitmap with a black background. I am copying this image from Google Chrome, which supports several clipboard formats, including DeviceIndependentBitmap and Format17 . Chrome copies the image to the clipboard in a 24bpp

In Jquery How to handle paste? [duplicate]

孤人 提交于 2019-12-01 03:33:20
问题 This question already has answers here : Closed 8 years ago . Possible Duplicates: How do you handle oncut, oncopy, and onpaste in jQuery? jQuery catch paste input I have a textarea, on paste to that textarea I want to format pasting values append to textarea could that be done in Javascript? 回答1: There is an onpaste event that works in modern day browsers: $("#textareaid").bind("paste", function(){}); Problem with the event, it tells you that it is about to happen, but it doesn't give you

Paste from Excel into C# app, retaining full precision

核能气质少年 提交于 2019-12-01 02:25:59
问题 I have data in an Excel spreadsheet with values like this: 0.69491375 0.31220394 The cells are formatted as Percentage, and set to display two decimal places. So they appear in Excel as: 69.49% 31.22% I have a C# program that parses this data off the Clipboard . var dataObj = Clipboard.GetDataObject(); var format = DataFormats.CommaSeparatedValue; if (dataObj != null && dataObj.GetDataPresent(format)) { var csvData = dataObj.GetData(format); // do something } The problem is that csvData

How to paste a transparent image from the clipboard in a C# winforms app?

我怕爱的太早我们不能终老 提交于 2019-12-01 00:59:10
问题 Note: This question is about pasting from the clipboard, not copying to the clipboard. There are several posts about copying to the clipboard, but couldn't find one that addresses this question. How can I paste an image with transparency, for example this one, into a winforms app and retain transparency? I have tried using System.Windows.Forms.GetImage() , but that produces a bitmap with a black background. I am copying this image from Google Chrome, which supports several clipboard formats,

Paste from MS Word into Textarea

a 夏天 提交于 2019-11-30 19:45:16
I'm using https://github.com/akzhan/jwysiwyg/ and i want to implement pasting from Word, but I'm not sure what to look for and how to handle it. Im more looking for a regex pattern or a list of characters to catch and what to replace them with. Ideas? I ended up using this: // Replaces commonly-used Windows 1252 encoded chars that do not exist in ASCII or ISO-8859-1 with ISO-8859-1 cognates. var replaceWordChars = function(text) { var s = text; // smart single quotes and apostrophe s = s.replace(/[\u2018|\u2019|\u201A]/g, "\'"); // smart double quotes s = s.replace(/[\u201C|\u201D|\u201E]/g, "

Copy a row from one sheet to another sheet if the row contains a certain value

孤街醉人 提交于 2019-11-30 16:34:55
This shouldn't be complicated code, but I am new to Excel VBA. I've tried many different methods resulting in bugs, infinite loops, and wrong selections. I need to go row by row through "Sheet1" selecting one row at a time, check if the value in Column J is correct (value = 131125), if it is then copy - paste the row to "Sheet2" (into the same row as it was in Sheet1). Help is much appreciated! :) Sub Test() For Each Cell In Sheets(1).Range("J:J") If Cell.Value = "131125" Then matchRow = Cell.Row Rows(matchRow & ":" & matchRow).Select Selection.Copy Sheets("Sheet2").Select ActiveSheet.Rows

“display:none” content copied to clipboard, visible when pasted

荒凉一梦 提交于 2019-11-30 09:12:40
I'm having a problem with non-displayed HTML elements being copied to the clipboard, and then displayed when the content is pasted into MS Word, Outlook, etc. For example: <p>Hello</p> <p style="display: none;">I'm Hidden</p> <p>World</p> If I view that HTML in a browser, copy the text to my clipboard, then paste into Outlook, the middle paragraph remains hidden. Good news. However, in this example: <p>Hello</p> <input type="text" value="I'm not hidden" style="display: none;" /> <p>World</p> If I do the same - copy to clipboard, paste into Outlook - the text input is visible. Is there any way

How to intercept (detect) a Paste command into a TMemo?

天大地大妈咪最大 提交于 2019-11-30 08:37:14
问题 How to catch Paste command and change text of Clipboard before that text is pasted into a TMemo, but, after Paste, text in Clipboard must be same like before changing? Example, Clipboard have text 'Simple Question', text that go in the TMemo is 'Симплe Qуeстиoн', and after that text in Clipboard is like before changing, 'Simple Question'. 回答1: Derive a new control that descends from 'TMemo' to intercept the WM_PASTE message: type TPastelessMemo = class(TMemo) protected procedure WMPaste(var