E
E
eldar_web2015-08-21 15:13:08
HTML
eldar_web, 2015-08-21 15:13:08

How to make a line break during a loop when generating an XML file in a cell?

I generate an XML file like this:

<?xml version="1.0"?>
<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">
  <Worksheet ss:Name="Sheet1">
    <Table>
      <Row>
        <Cell><Data ss:Type="String">№</Data></Cell>
        <Cell><Data ss:Type="String">Фамилия</Data></Cell>
        <Cell><Data ss:Type="String">Имя</Data></Cell>
        <Cell><Data ss:Type="String">Адрес</Data></Cell>
        <Cell><Data ss:Type="String">Примечание</Data></Cell>
        <Cell><Data ss:Type="String">Телефон</Data></Cell>
        <Cell><Data ss:Type="String">Газеты</Data></Cell>
      </Row>
    <% @subscribers.each.with_index 1 do |subscriber, index| %>
      <Row>
        <Cell><Data ss:Type="Number"><%= index %></Data></Cell>
        <Cell><Data ss:Type="String"><%= subscriber.surname %></Data></Cell>
        <Cell><Data ss:Type="String"><%= subscriber.name %></Data></Cell>
        <Cell><Data ss:Type="String"><%= subscriber.address.name %></Data></Cell>
        <Cell><Data ss:Type="String"><%= subscriber.address.description %></Data></Cell>
        <Cell><Data ss:Type="String"><%= subscriber.main_phone %></Data></Cell>
        <Cell><Data ss:Type="Text">
         <% subscriber.subscriptions.each do |subscription| %>
            <%= Newspaper.find(subscription.newspaper_id).name %><br />
          <% end %>
        </Data></Cell>
      </Row>
    <% end %>
    </Table>
  </Worksheet>
</Workbook>

I put it in the code <br />, but it does not wrap the line in the cell.
How to solve the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dexmaster, 2015-08-21
@Dexmaster

I don't remember which one, but try &#10; ("\n")
:

<Data ss:Type="Text">Первая строка&#10;Вторая строка</Data>

PS As a fallback, keep in mind&#13; ("\r")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question