答案 0 :(得分:0)
这将删除回车并调整行的大小
Public Sub removeCR(ByRef rng As Word.Table)
For Row = 1 To tbl.Rows.Count
For col = 1 To tbl.Columns.Count
Call tbl.Cell(Row, col).Select
With Selection
If Len(.Text) > 2 Then
If Mid(.Text, Len(.Text) - 2, 1) = vbCr Then
Let .Text = Left(.Text, Len(.Text) - 3) & chr$(7)
End If
End If
End With
Next col
Let tbl.Rows(Row).HeightRule = wdRowHeightAuto
Next Row
End Sub
如果您必须删除多个回车符,或者必须处理换行符,则可以考虑对最里面的If
语句进行修改,例如
While Mid(.Text, Len(.Text) - 2, 1) = vbCr Or _
Mid(.Text, Len(.Text) - 2, 1) = vbLf
Let .Text = Left(.Text, Len(.Text) - 3) & Chr$(7)
Wend
答案 1 :(得分:0)
以下内容将删除单元格标记末尾的¶
Dim rngcell As Range
Set rngcell = Selection.Cells(1).Range
rngcell.Start = rngcell.End - 2
rngcell.Text = Replace(rngcell.Text, vbCr, "")
答案 2 :(得分:0)
以下内容-文档中所有表格的所有单元格中的所有终止段落标记:
SimpleXlsReportConfiguration configuration =
new SimpleXlsReportConfiguration();
configuration.setOnePagePerSheet(false);
configuration.setRemoveEmptySpaceBetweenRows(true);
configuration.setWhitePageBackground(false);
configuration.setSheetNames(new String[] { sheetName });
.......
JRXlsExporter exporter = new JRXlsExporter();
ArrayList<JasperPrint> printList = new ArrayList<JasperPrint>();
printList.add(DynamicJasperHelper.generateJasperPrint(
this.createReport(), new ClassicLayoutManager(), params));
exporter.setExporterInput(SimpleExporterInput.getInstance(printList));
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(out));
exporter.setConfiguration(configuration);
最好不要将它们插入一开始,并且,直到我们看到OP的代码,我们才能建议如何最好地实现这一点。