Comments (8)
Would you mind creating a different issue specifically for this type of data and elaborating a little bit more on the use case then cite to this issue?
I thought about creating a new issue, but I think it's a bit more complicated, as the user would have to change the format, depending on his input. Custom formats would be perfect for that.
Excel uses a combination of many formats, when copying cells. For this example, I will copy those two cells:
Those cells have bold and centered text styling.
This is the clipboard:
Clipboard content
Click to expand
CF_TEXT
Hello World
HTML
Version:1.0
StartHTML:0000000105
EndHTML:0000001957
StartFragment:0000001757
EndFragment:0000001897
<html xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=ProgId content=Excel.Sheet>
<meta name=Generator content="Microsoft Excel 15">
<link id=Main-File rel=Main-File
href="file:///C:/Users/marvi/AppData/Local/Temp/msohtmlclip1/01/clip.htm">
<link rel=File-List
href="file:///C:/Users/marvi/AppData/Local/Temp/msohtmlclip1/01/clip_filelist.xml">
<style>
<!--table
{mso-displayed-decimal-separator:"\,";
mso-displayed-thousand-separator:"\.";}
@page
{margin:.75in .7in .75in .7in;
mso-header-margin:.3in;
mso-footer-margin:.3in;}
tr
{mso-height-source:auto;}
col
{mso-width-source:auto;}
br
{mso-data-placement:same-cell;}
td
{padding-top:1px;
padding-right:1px;
padding-left:1px;
mso-ignore:padding;
color:black;
font-size:11.0pt;
font-weight:400;
font-style:normal;
text-decoration:none;
font-family:Calibri, sans-serif;
mso-font-charset:0;
mso-number-format:General;
text-align:general;
vertical-align:bottom;
border:none;
mso-background-source:auto;
mso-pattern:auto;
mso-protection:locked visible;
white-space:nowrap;
mso-rotate:0;}
.xl65
{font-weight:700;
text-align:center;}
-->
</style>
</head>
<body link="#0563C1" vlink="#954F72">
<table border=0 cellpadding=0 cellspacing=0 width=128 style='border-collapse:
collapse;width:96pt'>
<col width=64 span=2 style='width:48pt'>
<tr height=19 style='height:14.5pt'>
<!--StartFragment-->
<td height=19 class=xl65 width=64 style='height:14.5pt;width:48pt'>Hello</td>
<td class=xl65 width=64 style='width:48pt'>World</td>
<!--EndFragment-->
</tr>
</table>
</body>
</html>
RTF
{\rtf1\ansi \ansicpg1252
{\fonttbl{\f0\fnil Calibri;}{\f1\fnil Calibri;}{\f2\fnil Calibri;}{\f3\fnil Calibri;}{\f4\fnil Calibri;}{\f5\fnil Calibri;}{\f6\fnil Calibri Light;}{\f7\fnil Calibri;}{\f8\fnil Calibri;}{\f9\fnil Calibri;}{\f10\fnil Calibri;}{\f11\fnil Calibri;}{\f12\fnil Calibri;}{\f13\fnil Calibri;}{\f14\fnil Calibri;}{\f15\fnil Calibri;}{\f16\fnil Calibri;}{\f17\fnil Calibri;}{\f18\fnil Calibri;}{\f19\fnil Calibri;}{\f20\fnil Calibri;}{\f21\fnil Calibri;}{\f22\fnil Segoe UI;}{\f23\fnil Calibri;}{\f24\fnil Calibri;}}
{\info{\id220}}\plain {\colortbl\red0\green0\blue0;\red255\green255\blue255;\red255\green0\blue0;\red0\green255\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red0\green255\blue255;\red0\green0\blue0;\red255\green255\blue255;\red255\green0\blue0;\red0\green255\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red0\green255\blue255;\red128\green0\blue0;\red0\green128\blue0;\red0\green0\blue128;\red128\green128\blue0;\red128\green0\blue128;\red0\green128\blue128;\red192\green192\blue192;\red128\green128\blue128;\red153\green153\blue255;\red153\green51\blue102;\red255\green255\blue204;\red204\green255\blue255;\red102\green0\blue102;\red255\green128\blue128;\red0\green102\blue204;\red204\green204\blue255;\red0\green0\blue128;\red255\green0\blue255;\red255\green255\blue0;\red0\green255\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green128\blue128;\red0\green0\blue255;\red0\green204\blue255;\red204\green255\blue255;\red204\green255\blue204;\red255\green255\blue153;\red153\green204\blue255;\red255\green153\blue204;\red204\green153\blue255;\red255\green204\blue153;\red51\green102\blue255;\red51\green204\blue204;\red153\green204\blue0;\red255\green204\blue0;\red255\green153\blue0;\red255\green102\blue0;\red102\green102\blue153;\red150\green150\blue150;\red0\green51\blue102;\red51\green153\blue102;\red0\green51\blue0;\red51\green51\blue0;\red153\green51\blue0;\red153\green51\blue102;\red51\green51\blue153;\red51\green51\blue51;;\red255\green255\blue255;\red100\green100\blue100;\red240\green240\blue240;\red0\green0\blue0;\red255\green255\blue255;\red160\green160\blue160;\red0\green120\blue215;\red0\green0\blue0;\red200\green200\blue200;\red55\green55\blue55;\red255\green255\blue255;\red100\green100\blue100;\red0\green0\blue0;\red255\green255\blue255;\red0\green0\blue0;\red255\green255\blue225;\red0\green0\blue0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\red192\green192\blue192;\red150\green150\blue150;\red128\green128\blue128;\red102\green102\blue102;\red51\green51\blue51;\red119\green198\blue253;\red255\green167\blue154;\red213\green173\blue252;\red0\green219\blue87;\red254\green153\blue255;\red255\green173\blue18;\red87\green210\blue218;\red51\green102\blue153;\red128\green0\blue0;\red0\green128\blue0;\red0\green0\blue128;\red128\green128\blue0;\red128\green0\blue128;\red0\green128\blue128;\red0\green0\blue208;\red224\green224\blue224;\red50\green106\blue199;\red0\green120\blue212;\red136\green23\blue152;\red227\green0\blue140;\red0\green78\blue140;\red209\green52\blue56;\red202\green80\blue16;\red3\green131\blue135;\red152\green111\blue11;\red164\green38\blue44;\red194\green57\blue179;\red57\green57\blue57;\red79\green107\blue237;\red117\green11\blue28;\red135\green100\blue184;\red122\green117\blue116;\red0\green91\blue112;\red92\green46\blue145;\red105\green121\blue126;\red142\green86\blue46;\red170\green170\blue170;\red0\green107\blue255;}
\trowd \trgaph30\trleft-30\trrh288\cellx946\cellx1922\pard \intbl \qc \f20\fs22 \b \cf8 Hello\cell \qc World\cell \pard \intbl \row}
XML Spreadsheet
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s65">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="11" ss:Color="#000000"
ss:Bold="1"/>
</Style>
</Styles>
<Worksheet ss:Name="Sheet1">
<Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="1"
ss:DefaultRowHeight="14.5">
<Row>
<Cell ss:StyleID="s65"><Data ss:Type="String">Hello</Data></Cell>
<Cell ss:StyleID="s65"><Data ss:Type="String">World</Data></Cell>
</Row>
</Table>
</Worksheet>
</Workbook>
CSV
Hello;World
As we can see here, excel uses multiple formats, to make pasting in different applications possible. The XML Spreadsheet
format, seems to be excels own. Outside of Excel, either HTML or RTF will be used to give the pasted content the styling.
Use Case
I suggest that something is added to inspect those different formats, and to modify them. In my case, I want to create a tool, that helps me to fill out an Excel sheet. I have to follow some style guidelines. So what I want to do is, get the information of the clipboard formats, and replace specific text. That way, if I paste into Excel, I will have the same style as the cells that I copied (with placeholders).
As an example: If I copy those cells:
I want to replace %NAME%
with Marvin Wendt
and %AGE%
with 21
.
Then, when I paste into Excel, it will look like this:
Another use case would be custom HTML styling. That way, we could put styled text into the users clipboard, which then can be pasted in programs like Word or other editors (maybe also online Editors like WordPress).
from clipboard.
Excuse me, is there currently a plan that supports file(.pdf, .txt...) types?
from clipboard.
We can actually start case by case. But that would be a different issue.
from clipboard.
Cool! May I ask, when will it start?
from clipboard.
There is no official plan for it. But things can get prioritized if we find this a high demand.
from clipboard.
There is no official plan for it. But things can get prioritized if we find this a high demand.
I got it. Thanks a lot.
from clipboard.
There is no official plan for it. But things can get prioritized if we find this a high demand.
I think custom formats would be awesome. Maybe also some functions to inspect the format, currently in the clipboard? For my application, I want to generate some Excel data, which should be styled. So if I could copy the data in the style I like, and then replicate the format, but change the content, that would be awesome!
from clipboard.
I want to generate some Excel data, which should be styled. So if I could copy the data in the style I like, and then replicate the format, but change the content, that would be awesome!
This is an interesting case. Would you mind creating a different issue specifically for this type of data and elaborating a little bit more on the use case then cite to this issue?
from clipboard.
Related Issues (20)
- can't work in the win service HOT 5
- Build fails with "error: implicit declaration of function 'nanosleep'" HOT 1
- bug: Image Write Doesn't Seem to Work on Linux and Windows (Ubuntu 20.04) HOT 10
- PNG data overwritten on Windows HOT 4
- How to watch copy file in windows10 HOT 3
- First thanks for your contribution. Maybe it's a stupid question, may i ask why can`t copy jpg image HOT 1
- Feature Request: Support to read and write raw content (without any formatting) from and into clipboards
- Housekeeping: update golang version and library dependencies HOT 2
- Windows 32-bit system will get stuck when executing. HOT 3
- Windows: Write an image encoded to PNG after being loaded as JPEG messes up the image HOT 5
- TestClipboardMultipleWrites only write text,no image. HOT 1
- The shortcut key Ctrl+C cannot be detected when copying images. HOT 4
- Remove cgo requirements on macOS HOT 2
- suggestion: making `Write` blocking instead of returning a channel HOT 30
- Add *BSD support
- Hangs / slow on Linux
- Don't panic when headless HOT 1
- Is `clipboard.Write(clipboard.FmtImage, []byte)` not design to copy any other format than `PNG`? HOT 1
- 可以做成像 electron 那样,同时写入多种内容么,例如同时写入 text 和 html
- Crashing on wayland
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clipboard.