Often we get into a problem of having line breaks in export. This mostly happens in VirtueMart export and when exporting product_desc or product_s_desc field. It is possible to remove these line breaks RO CSVI multi replace plugin. This document explains on replacing line breaks in RO CSVI Exports.
At first, create a export template using the following steps.
- Go to Components -> CSVI Pro -> Templates
- Click New
- Give the template a name, say for example VirtueMart Product export
- Set Action to Export
- Set Component to VirtueMart
- Set Operation to Product
- Click Next: Select Destination
- Destination is set default to Download.
- Click Next: Select options
- The default values are OK, change if needed.
- Click Next: Select fields
- Add the fields to be exported
- Click Next: Finalize
- All done here
- Click Close to return to the list of templates or Edit if you want to fine-tune the template further.
Add template fields for the export template, for our example we are exporting product_sku, product_name and product_desc fields.
Template fields can be added by following these steps:
- Go to Components -> CSVI Pro -> Templates
- Click on Template fields
- In the Search Tools select your template
- Click on New to add a single field or click on Quick Add to add multiple fields.
Quick Add
The Quick Add Option allows you to quickly add multiple fields to a template. It is not possible to set any settings per field here but that can be done after the fields have been added to the template.
Now say when you do the product export, product_desc field data is exported like below image when rule is not applied.
Create a multi replace rule for replacing line breaks to space in Rules page and apply it on product_desc in template fields page.
- Go to Components -> CSVI Pro -> Templates
- Click on Rules
- Click New
- Give a name to the Rule
- Select Action as Export
- Select Plugin as Multireplace
- Click Load plugin button
- Save the rule before continuing further
- Since we are creating a find and replace for line breaks here, Select operation as Find and replace
- In the Filter part, in Find field set expression to be /\r\n/, Replace field should be a space or empty, Method to be Regular expression, Other fields can be left with default values.
- Save the rule
- Now go to template fields and apply the created rule on product_desc field by selecting the rule in Rules field.
Thats it. Run the export from CSVI export page and by selecting the export template. Your product_desc or product_s_desc fields should be exported without line breaks like the image below