Jump to content
You must now use your email address to sign in [click for more info] ×

Is it possible to paste html text from webpage and maintain style?


Recommended Posts

I am preparing a journal with articles that have been published online. I need to prepare these for printing as well, so I was thinking of using the html as the basis. 

I would like to copy the text from this webpage, then paste into a text column in Publisher. This is possible, but all styles are lost (including superscript). However, if I paste into a word document, then copy and repasted, it would work.

Am I missing something?

Link to comment
Share on other sites

Hi @ssciberras and welcome to the forums. I just tried copying and pasting a page from Wikipedia into Publisher 2.2.1 and MS Word and got very similar results.

But regardless, you should reformat the articles in Publisher with paragraph styles for consistent formatting. Copying from HTML isn't going to provide useful formatting for print.

Good luck.

Download a free manual for Publisher 2.3 from this forum - expanded 260-page PDF

Affinity 2.3.1 for macOS Sonoma 14.3, MacBook Pro 14" (M1 Pro)

 

Link to comment
Share on other sites

  • Staff

Thanks for your post @ssciberras!

15 hours ago, ssciberras said:

I would like to copy the text from this webpage, then paste into a text column in Publisher. This is possible, but all styles are lost (including superscript). However, if I paste into a word document, then copy and repasted, it would work.

Am I missing something?

As I understand it, Affinity Publisher does not support pasting text using the HTML format at this time.

When copying text from a web source, such as Wikipedia and using Edit > Paste Special in Affinity, the only option shown is Unicode Text, which is essentially unformatted.

image.png

When copying text from a web source, such as Wikipedia and using Edit > Paste Special in Microsoft Word, there are multiple options offered, the default of which is HTML, retaining the formatting.

image.png

When copying text from Microsoft Word and using Edit > Paste Special in Affinity, there are multiple options now offered, the default of which is Rich Text Format, retaining the formatting. (Note on Windows you will also see the Windows specific metadata options also)

image.png

I hope this clears things up!

Link to comment
Share on other sites

13 minutes ago, MikeTO said:

Ah, thanks. I didn't realize that Windows copies web pages to the clipboard as HTML. macOS uses RTF for that.

I've tested several browsers, and all provide HTML format as a choice in the Clipboard. The Affinity applications, however, don't offer to Paste that format.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.3, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.3

Link to comment
Share on other sites

Indeed, I am using a Macbook.

I have tried Wikipedia again: the same issue occurs.

Jessie Margaret Murray was born in Hazaribagh, British India, on 9 February 1867 to Hugh Hildyard Murray, a lieutenant of the Royal Artillery, and Frances Jane Murray. The couple also had two younger daughters while in India, Mary Ethel and Edith May. In about 1880 Frances Murray and her children travelled to Edinburgh, where they settled; by 1891 they were living in London. Five years later the family was living in Bayswater, West London, when Hugh, then a retired colonel, died.[1]

 

becomes 

Jessie Margaret Murray was born in Hazaribagh, British India, on 9 February 1867 to Hugh Hildyard Murray, a lieutenant of the Royal Artillery, and Frances Jane Murray. The couple also had two younger daughters while in India, Mary Ethel and Edith May. In about 1880 Frances Murray and her children travelled to Edinburgh, where they settled; by 1891 they were living in London. Five years later the family was living in Bayswater, West London, when Hugh, then a retired colonel, died.[1]

As you see, the superscript is lost. For a journal, that is a big issue. Furthermore all hyperlinks are also lost. Also I do not have Paste special in Affinity.

image.png.39cdbbb1d6df9b70fe9b1427bfc0a331.png

If I first paste into Word, then the formatting is preserved.

Pity. I was really hoping to use Publisher for this.

 

Thanks

S

Link to comment
Share on other sites

15 minutes ago, ssciberras said:

Also I do not have Paste special in Affinity.

No, as that is only available on Windows.

-- Walt
Designer, Photo, and Publisher V1 and V2 at latest retail and beta releases
PC:
    Desktop:  Windows 11 Pro, version 23H2, 64GB memory, AMD Ryzen 9 5900 12-Core @ 3.00 GHz, NVIDIA GeForce RTX 3090 

    Laptop:  Windows 11 Pro, version 23H2, 32GB memory, Intel Core i7-10750H @ 2.60GHz, Intel UHD Graphics Comet Lake GT2 and NVIDIA GeForce RTX 3070 Laptop GPU.
iPad:  iPad Pro M1, 12.9": iPadOS 17.3, Apple Pencil 2, Magic Keyboard 
Mac:  2023 M2 MacBook Air 15", 16GB memory, macOS Sonoma 14.3

Link to comment
Share on other sites

HTML (Hyper Text Markup Language) offers a basic text structure i.e block text, paragraph emphasis, lists and strong but CSS (Cascading Style Sheet) is primarily used for text styling. That said none of the Affinity apps can handle HTML nor CSS so you will have to use the dev tab in a browser to find out a text's CSS attributes or be able to access the CSS file to glean styling info.

So it's a case of stripping any formatting and starting from scratch unless you know of an app that can convert CSS to Document text styles.

https://developer.mozilla.org/en-US/docs/Learn/HTML/Introduction_to_HTML/Advanced_text_formatting

iMac 27" 2019 Somona 14.3.1, iMac 27" Affinity Designer, Photo & Publisher V1 & V2, Adobe, Inkscape, Vectorstyler, Blender, C4D, Sketchup + more... XP-Pen Artist-22E, - iPad Pro 12.9 B|  Add a signature like this so system and app info always seen. Tagging is the gift that keeps on giving. Please consider adding tags to your post, not only does it help searching later on but it helps us, to give focused replies and is greatly appreciated by those that do reply, remember Affinity is for life not just Christmas. 

(Please refrain from licking the screen while using this forum)

Affinity Help - Affinity Desktop Tutorials - Feedback - FAQ - most asked questions

Link to comment
Share on other sites

1 hour ago, ssciberras said:

Indeed, I am using a Macbook.

I have tried Wikipedia again: the same issue occurs.

Jessie Margaret Murray was born in Hazaribagh, British India, on 9 February 1867 to Hugh Hildyard Murray, a lieutenant of the Royal Artillery, and Frances Jane Murray. The couple also had two younger daughters while in India, Mary Ethel and Edith May. In about 1880 Frances Murray and her children travelled to Edinburgh, where they settled; by 1891 they were living in London. Five years later the family was living in Bayswater, West London, when Hugh, then a retired colonel, died.[1]

becomes 

Jessie Margaret Murray was born in Hazaribagh, British India, on 9 February 1867 to Hugh Hildyard Murray, a lieutenant of the Royal Artillery, and Frances Jane Murray. The couple also had two younger daughters while in India, Mary Ethel and Edith May. In about 1880 Frances Murray and her children travelled to Edinburgh, where they settled; by 1891 they were living in London. Five years later the family was living in Bayswater, West London, when Hugh, then a retired colonel, died.[1]

As you see, the superscript is lost. For a journal, that is a big issue. Furthermore all hyperlinks are also lost. Also I do not have Paste special in Affinity.

That's not what I'm seeing on macOS. It's coming in as formatted text and the [1] is superscripted. Note that Wikipedia's styles change the font size for the superscripted [1] - if you change the font size in Publisher back to match the surrounding text the superscript, the superscript will look a bit more natural than it does in my screenshot.

Screenshot2023-11-15at5_28_42PM.png.a890b16892beb3e6279b08736f52a7d9.png

Download a free manual for Publisher 2.3 from this forum - expanded 260-page PDF

Affinity 2.3.1 for macOS Sonoma 14.3, MacBook Pro 14" (M1 Pro)

 

Link to comment
Share on other sites

1 hour ago, ssciberras said:

This is only working with Wikipedia articles. Other html webpages do not get pasted with any markdown

If that's what you're seeing then I assume you're not using Safari.

Copying from Google Chrome on macOS will result in the loss of formatting because it doesn't copy web pages to the pasteboard in RTF format. It only copies in HTML and plain text and since Affinity doesn't support HTML it has to use plain text. Safari copies in RTF, HTML, and plain text.

Download a free manual for Publisher 2.3 from this forum - expanded 260-page PDF

Affinity 2.3.1 for macOS Sonoma 14.3, MacBook Pro 14" (M1 Pro)

 

Link to comment
Share on other sites

You could simply use those numbers as placeholders for the footnotes.
I assume you want to recreate the footnotes.
So if you place the cursor next to the "1" and then create the actual footnote the superscript "1" for that footnote will appear - then delete the placeholder "1".

Link to comment
Share on other sites

The issue is that medical articles will have up to 30 -40 references, so I have to hunt 15 articles each time for something so inconspicuous. I would have assumed that something like super script, even 'th' as in '4th' would be ok.

Unfortunately, it seems that this is a problem not simply with Publisher, but will Mac OS (?) as the super tags are being changed to a \fs tag in RTF. All word processing programs are not working. I am not sure how wikipedia works however - why does pasting from wikipedia retain the super tag?

from: https://en.wikipedia.org/wiki/Alan_Shepard

<sup id="cite_ref-FOOTNOTEBurgess201470_7-0" class="reference"><a href="#cite_note-FOOTNOTEBurgess201470-7">[7]</a></sup>

 

{\rtf1\ansi\ansicpg1252\cocoartf2757
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fswiss\fcharset0 Helvetica-Oblique;}
{\colortbl;\red255\green255\blue255;\red24\green25\blue26;\red255\green255\blue255;\red39\green78\blue192;
}
{\*\expandedcolortbl;;\cssrgb\c12549\c12941\c13333;\cssrgb\c100000\c100000\c100000;\cssrgb\c20000\c40000\c80000;
}
\paperw11900\paperh16840\margl1440\margr1440\vieww14840\viewh11460\viewkind0
\deftab720
\pard\pardeftab720\sa140\partightenfactor0

\f0\fs28 \cf2 \cb3 \expnd0\expndtw0\kerning0
Alan Bartlett Shepard Jr. was born on November 18, 1923, at 64 Hampstead Road
\fs22\fsmilli11200 \cf4 \super [1]
\fs28 \cf2 \nosupersub  in {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/Derry,_New_Hampshire"}}{\fldrslt \cf4 Derry, New Hampshire}},
\fs22\fsmilli11200 \cf4 \super [2]
\fs28 \cf2 \nosupersub  to Alan Bartlett Shepard Sr. and Pauline Renza Shepard ({\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/Birth_name#Maiden_and_married_names"}}{\fldrslt \cf4 n\'e9e}}\'a0Emerson).
\fs22\fsmilli11200 \cf4 \super [3]
\fs28 \cf2 \nosupersub  He had a younger sister, Pauline, who was known as Polly.
\fs22\fsmilli11200 \cf4 \super [4]
\fs28 \cf2 \nosupersub  The two were descendants of {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/Mayflower"}}{\fldrslt 
\f1\i \cf4 Mayflower}} passenger {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/Richard_Warren"}}{\fldrslt \cf4 Richard Warren}}, 
\fs22\fsmilli11200 \cf4 \super [3]
\fs28 \cf2 \nosupersub  and were related to {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/Scottish_people"}}{\fldrslt \cf4 Scottish}} emigrants from {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/Berneray_(North_Uist)"}}{\fldrslt \cf4 Berneray}} in the {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/Outer_Hebrides"}}{\fldrslt \cf4 Outer Hebrides}}, through the Shepard line.
\fs22\fsmilli11200 \cf4 \super [5]
\fs28 \cf2 \nosupersub  Alan Bartlett Shepard Sr., known as Bart, worked in the Derry National Bank, owned by Shepard's grandfather. Bart joined the {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/National_Guard_of_the_United_States"}}{\fldrslt \cf4 National Guard}} in 1915 and served in France with the {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/American_Expeditionary_Force"}}{\fldrslt \cf4 American Expeditionary Force}} during {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/World_War_I"}}{\fldrslt \cf4 World War I}}.
\fs22\fsmilli11200 \cf4 \super [6]
\fs28 \cf2 \nosupersub  He remained in the National Guard between the wars, and was recalled to active duty during {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/World_War_II"}}{\fldrslt \cf4 World War II}}, rising to the rank of {\field{\*\fldinst{HYPERLINK "https://en.wikipedia.org/wiki/Lieutenant_colonel_(United_States)"}}{\fldrslt \cf4 lieutenant colonel}}.
\fs22\fsmilli11200 \cf4 \super [7]}

compared to : http://mmsjournals.org/index.php/mmj/article/view/601

<sup class="tooltipstered">1</sup>

{\rtf1\ansi\ansicpg1252\cocoartf2757
\cocoatextscaling0\cocoaplatform0{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;\red0\green0\blue0;\red255\green255\blue255;}
{\*\expandedcolortbl;;\cssrgb\c0\c0\c0\c87059;\cssrgb\c100000\c100000\c100000;}
\paperw11900\paperh16840\margl1440\margr1440\vieww14840\viewh11460\viewkind0
\deftab720
\pard\pardeftab720\sa400\qj\partightenfactor0

\f0\fs28 \cf2 \cb3 \expnd0\expndtw0\kerning0
The world population is ageing, transforming societies from youth-dominated age profiles to age profiles where over 20% of the population are aged above 65 years. The global ageing population has been related to the recent socioeconomic development through falling fertility rates and increased life expectancy at birth. The multimorbidity of these populations increases the difficulty of maintaining oral health for frail older adults.
\fs21 1
\fs28  Lack of oral health increase morbidity in this population.
\fs21 2

Link to comment
Share on other sites

4 hours ago, ssciberras said:

Unfortunately, it seems that this is a problem not simply with Publisher, but will Mac OS (?) as the super tags are being changed to a \fs tag in RTF. All word processing programs are not working.

Yes, the problem is with Safari or macOS and not with Publisher, but I'm not entirely sure why it doesn't work for the site you asked about. There must be something in the css but I took a quick glance and didn't see any likely suspects. You'll get the same results if you pasted from that site into Pages.

But MS Word can import HTML so if you have that, you could roundtrip through MS Word. Paste into Word, copy, and paste into Publisher. I gave it a test with the page you provided and it worked fine.

Download a free manual for Publisher 2.3 from this forum - expanded 260-page PDF

Affinity 2.3.1 for macOS Sonoma 14.3, MacBook Pro 14" (M1 Pro)

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.