我正在尝试使用VBA在单词表中向下移动一个单元格;问题是当我使用unit:=wdCell
时,它给我一个运行时错误。我可以使用默认的wdLine
,它可以正常工作,但是,如果该单元格有多行,那么我将在第二行而不是下一个单元格结束。
With Selection
.MoveDown Unit:=wdCell, Count:=1, Extend:=wdMove
.Expand wdCell
.Range.Text = "Hello World"
End With
答案 0 :(得分:0)
由于某些原因,您不能将wdCell
用作Move*
的参数,而With Selection
.MoveEnd wdCell
.MoveDown wdLine, Count:=1
.Expand wdCell
End With
似乎没有记录在案。
一种解决方法是跳到单元格的末尾,然后向下移动一行:
With Selection
Dim r As Long, c As Long
r = .Rows(1).Index
c = .Columns(1).Index
If .Rows(1).Parent.Rows.Count >= r + 1 Then
.Rows(1).Parent.Rows(r + 1).Cells(c).Range.Select
End If
End With
另一种解决方法是转到locate yourself in the table并按索引跳到下一个单元格:
@Bean
public FlatFileItemReader<Transaction> csvTransactionReader() {
FlatFileItemReader<Transaction> reader = new FlatFileItemReader<>();
reader.setResource(new ClassPathResource("20190306Z_transaction_succeeded.consolidated.csv"));
reader.setLinesToSkip(1);
reader.setLineMapper(new DefaultLineMapper<Transaction>() {{
setLineTokenizer(new DelimitedLineTokenizer() {{
setNames("txId", "txState", "amount", "currency", "accountHolderName", "merchantTxId");
setIncludedFields(0, 1, 4, 5, 6, 9);
}});
setFieldSetMapper(new BeanWrapperFieldSetMapper<Transaction>() {{
setTargetType(Transaction.class);
}});
}});
return reader;
}