-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow Custom Format #17
Comments
Excuse me, is there currently a plan that supports file(.pdf, .txt...) types? |
We can actually start case by case. But that would be a different issue. |
Cool! May I ask, when will it start? |
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. |
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! |
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? |
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
CF_TEXT
HTMLVersion: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
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
As we can see here, excel uses multiple formats, to make pasting in different applications possible. The Use CaseI 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 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). |
What is the progress on this? |
Currently, we only support UTF-8 text and PNG-encoded image data. However, there are much more formats than that.
Let's support registering custom format and handlers so that this package can help any other unregistered format. API design could be:
The text was updated successfully, but these errors were encountered: