Commons:Convert tables and charts to wiki code or image files

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

See also: Template:Table. And: Commons:Chart and graph resources. And: Commons:Create charts and graphs online.

Here are some tools, resources, tips, and instructions for converting tables and charts to wiki code or image files. Most of the tools and resources are free.

Some starting points[edit]

Sandboxes[edit]

Return to top.

Sandboxes help a lot. For example; your user page: Special:MyPage. Create and bookmark some personal sandboxes too: Special:MyPage/Sandbox, Special:MyPage/Sandbox2, Special:MyPage/Sandbox3. As many as you want. Share the link when asking for help. Wikipedia user pages have Visual Editor enabled by default. But not on talk pages. Visual Editor will load very fast in empty sandboxes. To find all your sandboxes: Special:PrefixIndex/User: - click link, add user name to spot labeled "Display pages with prefix:"

Web table (HTML-based) to wiki code[edit]

See en:Help:Table sections on the Visual Editor first. Most HTML tables can be copied directly off the page into VE. If not, try the methods below that use the actual HTML code.

LibreOffice[edit]

Return to top.

Convert web page tables (HTML-based) to wiki code. You can save any web page as an HTML file, and then open it in LibreOffice Writer. Sometimes you can paste parts of web pages directly into LibreOffice Writer. Continue editing there. Remove non-table stuff for example. Then export it to Mediawiki:

  • LibreOffice Writer is free. It can open almost any file format. It can export to Mediawiki. File menu > export > save as type > MediaWiki. It will save the file as a .txt file which can be opened with any text editor. Copy the wiki code from the text file.

HTML to Wiki converters[edit]

Return to top.

Other more technical tools[edit]

Return to top.

Move decimal point of a column[edit]

Or multiply/divide by 10/100/1000/etc[edit]

Return to top.

This is useful for example, when the source table has population in 1000s and you want straight population numbers.

Open up the relevant spreadsheet, or copy the column alone, to LibreOffice Calc. While doing the following do not leave the spreadsheet to go elsewhere while doing this, or it may not work. You will have to start over by correctly copying the cell again.

See: Multiple the numbers of a specific column with a number in libre office.

You must copy 10/100/1000/etc. from a LibreOffice Calc cell on the same page. You can't just copy the number from a text editor, etc.. Enter the number into a Calc cell. Select the cell, not the number in the cell. Then: Edit menu > Copy. Or right click the cell, and then click copy from the popup menu. When done correctly, the border of the cell will have a blinking dashed line around it.

Then without going elsewhere first, select the column you want to change. Do this by clicking its column head. Then right click it, and click "Paste Special" from the menu that pops up. Only then will the full "Paste Special" menu show up. See the forum link higher up to see a picture of a version of that full "Paste special" menu. You can also click "Paste Special" via Edit menu > Paste Special > Paste Special.

In the "Operations" section click Multiply or Divide. Then click OK. The numbers in the column will be changed accordingly.

Conversion examples. Sandboxes for updating tables.[edit]

Return to top. See: w:Help:Table. It has a section on adding links and flags to country lists. See also the sections on tables and the Visual Editor (VE). That VE help covers much of what used to be here.

User sandboxes with info for updating tables with country lists. See the talk pages for updated info and later sandboxes.

From Help:Table: Sandboxes help a lot. For example; your user page: Special:MyPage. Create and bookmark some personal sandboxes too. Visual Editor will load very fast in empty sandboxes: Special:MyPage/Sandbox, Special:MyPage/Sandbox2, Special:MyPage/Sandbox3. As many as you want. Share the link when asking for help. To find all your sandboxes: Special:PrefixIndex/User: – click link, add user name to the spot labeled "Display pages with prefix:".

PDF to image files[edit]

Return to top.

See: Commons:PDF to image files

PDF tools[edit]

Return to top.

Some of the previous sections refer to PDF files. Wikipedia has a comprehensive list of PDF software. Much of it is free and open source.

Convert PDF to Excel Free Online - No email required. This free site works great. Upload PDF. Converts to Excel file in less than a minute. Download it. Open it with freeware LibreOffice Calc.

CNET has a category: PDF Software Downloads for Windows. Much of it is free, or free to try. Click "free" link in the left sidebar for freeware. Initial sort is by downloads last week. Recent popularity is usually a good comparative guide to ease of use.

Appropedia has notes on porting PDF files to MediaWiki.

For tables and charts, converting PDF to SVG is usually the optimal choice if you have the skills and tools to do so. Two programs that can do this are:

Convert wiki tables to Excel[edit]

Return to top.

See also: en:Help:Table

Maybe you need to work on some tables, and prefer to work in Excel:

Convert Excel to CSV[edit]

Return to top.

Convert xls, xlsx, etc. to CSV. CSV files create clean tables since CSV contains only values, headers, rows, and columns. No other formatting. So they are great for converting to clean wikitext tables.

Online tools[edit]

Return to top.

Convert CSV, DSV, or Excel to HTML or wikitext[edit]

Return to top.

Convert Excel, comma-separated values (CSV), tab-separated values, delimiter-separated values (DSV), etc. to table wiki code.

Online tools[edit]

Return to top.

Microsoft Word to wiki code[edit]

Return to top.

Microsoft Word converters. See:

Print screen, and then edit chart image[edit]

Return to top.

The charts can be converted to images by using the "Print Screen" key on a keyboard. Image editors can then be used to capture and crop the chart found on the screenshot.

There are many free image editors. See:

For example; there is the free, popular, easy-to-use Irfanview. Use it to resize charts, remove watermarks, crop unused space from around the edges, and so on. Irfanview can also losslessly compress PNG images so as to use less kilobytes for the same image without any loss in image quality. Install the Irfanview plugin pack too. It installs instantly and includes even better PNG compression, PNGOUT, which is easy to use in Irfanview.

Add text to chart images[edit]

Return to top.

Freeware IrfanView, (and many other image editors), is useful for adding text to charts and other images. Open a chart in IrfanView. Crop the chart as needed. The smaller the margins, the better for the chart showing up more clearly in Wikipedia articles at smaller sizes. Click on the chart where you want text to begin, and drag a large rectangle box where the text will be inserted. Make it large since text will not extend outside the box. The box lines do not remain after you finish editing the image. After you have drawn a box go to the edit menu, and click on "insert text". Choose left, center, or right alignment. Pick your font, font size, and color from the dialog box. Then click "preview" in the dialog box. The text will be inserted temporarily in the large box. The background will not be effected if the background is set to "transparent" in the dialog box. Change your settings until you get what you want in the preview. Then click "OK" in the dialog box. Save the image when you are done.

Editing resulting image files[edit]

There are many tools, and help pages. See:

Removing part of an image, and splicing the parts[edit]

This is useful for many charts and maps. See this version of this map. It was created by removing a section of the map image found at the source.

A freeware image editor can be used such as IrfanView. In this case it was used to remove part of the screenshot image, splice the remaining parts, and add a border:

  • Edit menu > remove strip.
  • Image menu > add border.

Spreadsheets to automatically convert Excel data to SVG code[edit]

See User:RCraig09/Excel to XML for SVG for a description of how users can use my Microsoft Excel spreadsheets to automatically generate efficient SVG code for charts.

My spreadsheets are completely text-based (manually choosing options for margins, axis data ranges, etc.), and are not as polished as graphics-based commercial products. RCraig09 (talk) 18:25, 14 February 2024 (UTC)[reply]

See also[edit]

Return to top.